Inference for Segmentations#

Semantic segmentation models label each sample with a Segmentation field, while instance segmentation output is stored as a Detections field whose Detection instances carry per-object masks. Both are populated by passing a model to apply_model().

The Segmentation Guide walks through applying a zoo model — Segment Anything 2 — to generate segmentations from prompts.

For a custom model, configure a TorchImageModel with an InstanceSegmenterOutputProcessor or SemanticSegmenterOutputProcessor so it works with apply_model() directly, as described in Inference with custom models.