satellit_sam.cli.predict

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

Predict command group and command handlers for the satellit CLI.

Back to API index

Functions

image_masks

def image_masks(
    image_path: Annotated[
        Path,
        typer.Option(
            "--image",
            help="Path to the input image file.",
            exists=True,
            file_okay=True,
            dir_okay=False,
            readable=True,
        ),
    ],
    output_path: Annotated[
        Path,
        typer.Option(
            "--output-path",
            help="Directory path where prediction outputs will be saved.",
        ),
    ] = Path("output/predict"),
    text_prompt: Annotated[
        str | None,
        typer.Option(
            "--text", help="Text prompt for segmentation filtering (e.g. 'tree')."
        ),
    ] = None,
    bbox_prompts: Annotated[
        list[str] | None,
        typer.Option(
            "--bbox",
            help="Bounding-box prompt in image coordinates as x1,y1,x2,y2. Repeat --bbox to provide multiple boxes.",
        ),
    ] = None,
    point_prompts: Annotated[
        list[str] | None,
        typer.Option(
            "--point",
            help="Point prompt in image coordinates as x,y. Repeat --point to provide multiple points. Current SAM3 processor support approximates point prompts as small box prompts.",
        ),
    ] = None,
    model: Annotated[
        Literal["sam3", "sam2", "dinov3"],
        typer.Option(
            "--model",
            help="Model backend to use: sam3 (default), sam2, or dinov3. dinov3 currently supports --text only.",
        ),
    ] = "sam3",
    threshold: Annotated[
        float,
        typer.Option(
            "--threshold",
            min=0.0,
            max=1.0,
            help="Confidence threshold for keeping predicted masks (0.0-1.0).",
        ),
    ] = 0.5,
    tile_size: Annotated[
        int,
        typer.Option(
            "--tile-size", min=1, help="Tile size in pixels for streamed prediction."
        ),
    ] = 640,
    tile_overlap: Annotated[
        int,
        typer.Option(
            "--tile-overlap",
            min=0,
            help="Overlap between neighboring prediction tiles in pixels.",
        ),
    ] = 64,
    merge_iou_threshold: Annotated[
        float,
        typer.Option(
            "--merge-iou-threshold",
            min=0.0,
            max=1.0,
            help="IoU threshold for global cross-tile NMS merge (0.0-1.0).",
        ),
    ] = 0.5,
    weak_labels_csv: Annotated[
        Path | None,
        typer.Option(
            "--weak-labels-csv",
            help="Path to labels_tiles.csv generated by 'label weak'. Uses stored per-tree tile-local bboxes as box prompts.",
            exists=True,
            file_okay=True,
            dir_okay=False,
            readable=True,
        ),
    ] = None,
) -> None:
Predict and visualize image masks from text, bbox, and/or point prompts.

Arguments

  • image_path: Input image path. output_path: Output directory for generated artifacts. text_prompt: Optional text prompt. bbox_prompts: Optional image-space bbox prompts. point_prompts: Optional image-space point prompts. model: Segmentation model version selector. threshold: Confidence threshold for keeping predicted masks. tile_size: Tile size in pixels for streamed prediction. tile_overlap: Tile overlap in pixels for streamed prediction. merge_iou_threshold: IoU threshold used for cross-tile NMS merge. weak_labels_csv: Optional weak-label CSV with tile-local prompts.

Exceptions

  • typer.BadParameter: If prompt arguments are invalid.

Classes

No public classes.