satellit_sam.workflows.predict.image_masks

Auto-generated from satellit_sam/src/satellit_sam/workflows/predict/image_masks.py by satellit_sam/scripts/generate_api_docs.py.

Image-mask prediction workflow for streamed full-image segmentation inference.

Back to API index

Functions

predict_image_masks

def predict_image_masks(
    image_path: Path,
    output_path: Path,
    text_prompt: str | None,
    bbox_prompts: list[tuple[float, float, float, float]],
    point_prompts: list[tuple[float, float]],
    model: Literal["sam3", "sam2", "dinov3"] = "sam3",
    threshold: float = 0.5,
    tile_size: int = 640,
    tile_overlap: int = 64,
    merge_iou_threshold: float = 0.5,
    weak_label_bboxes_by_tile: dict[str, list[tuple[float, float, float, float]]]
    | None = None,
    command: str | None = None,
) -> None:
Predict image masks from one image and save outputs.

The workflow:

  1. streams model inference over image tiles,
  2. merges tile detections globally via NMS,
  3. saves per-tile strong-label artifacts,
  4. saves one mask visualization, and
  5. saves merged predicted masks and metadata as one .npz file.

Arguments

  • image_path: Path to the input image. output_path: Output directory for all artifacts. text_prompt: Optional text prompt for segmentation filtering. bbox_prompts: Optional image-space bbox prompts. point_prompts: Optional image-space point prompts. model: Segmentation model family to use (``sam3``, ``sam2``, ``dinov3``). threshold: Confidence threshold for keeping predicted masks. tile_size: Prediction tile size in pixels. tile_overlap: Overlap between neighboring prediction tiles in pixels. merge_iou_threshold: IoU threshold for cross-tile NMS merge. weak_label_bboxes_by_tile: Optional tile-local bboxes keyed by tile id. command: Optional CLI command string used to start the run.

Exceptions

  • ValueError: If inputs or prompt combinations are invalid.

Classes

No public classes.