satellit_sam.sam3

Auto-generated from satellit_sam/src/satellit_sam/sam3.py by satellit_sam/scripts/generate_api_docs.py.

Segmentation model wrappers and inference helpers for SAM and DINOv3.

Back to API index

Functions

get_sam

def get_sam(model_name: ModelVersion = "sam3") -> SamSingleton:

Return a cached SAM model wrapper for the selected model version.

Classes

SamSingleton

Singleton wrapper for loading and running a selected segmentation model.

Attributes

No public class attributes detected.

Methods

def print_debug_info(self):

Print runtime versions and CUDA availability for diagnostics.

predict
def predict(
    self,
    image: Image,
    text: str | None = None,
    boxes: list[tuple[float, float, float, float]] | None = None,
    box_labels: list[int] | None = None,
    points: list[tuple[float, float]] | None = None,
    point_labels: list[int] | None = None,
    threshold: float = 0.5,
    mask_threshold: float = 0.5,
    confidence_threshold: float = 0.5,
    allow_low_confidence_fallback: bool = False,
) -> Image:
Generate and render segmentation predictions for one image.

Arguments

  • image: Image to segment. text: Optional text prompt. boxes: Optional list of box prompts in ``x1,y1,x2,y2`` format. box_labels: Optional per-box labels for the SAM processor. points: Optional list of point prompts in ``x,y`` format. point_labels: Optional per-point labels for the SAM processor. threshold: Score threshold used in SAM post-processing. mask_threshold: Pixel mask threshold used in SAM post-processing. confidence_threshold: Minimum confidence required to keep detections. allow_low_confidence_fallback: Whether to keep the top-scoring mask when score filtering removes all detections.

Returns

  • Annotated image with segmentation overlays.
predict_detections
def predict_detections(
    self,
    image: Image,
    text: str | None = None,
    boxes: list[tuple[float, float, float, float]] | None = None,
    box_labels: list[int] | None = None,
    points: list[tuple[float, float]] | None = None,
    point_labels: list[int] | None = None,
    threshold: float = 0.5,
    mask_threshold: float = 0.5,
    confidence_threshold: float = 0.5,
    allow_low_confidence_fallback: bool = False,
) -> sv.Detections:
Generate segmentation detections for one image.

Arguments

  • image: Image to segment. text: Optional text prompt. boxes: Optional list of box prompts in ``x1,y1,x2,y2`` format. box_labels: Optional per-box labels for the SAM processor. points: Optional list of point prompts in ``x,y`` format. point_labels: Optional per-point labels for the SAM processor. threshold: Score threshold used in SAM post-processing. mask_threshold: Pixel mask threshold used in SAM post-processing. confidence_threshold: Minimum confidence required to keep detections. allow_low_confidence_fallback: Whether to keep the top-scoring mask when score filtering removes all detections.

Returns

  • Filtered detections including masks, boxes, and confidence scores.

Exceptions

  • ValueError: If no prompts are provided.