---
title: models.sam.predict API Reference
description: Explore Ultralytics SAM and SAM 2 Predictor for advanced, real-time image segmentation using the Segment Anything Model (SAM and SAM 2). Complete implementation details and auxiliary utilities.
keywords: Ultralytics, SAM, Segment Anything Model, SAM 2, Segment Anything Model 2, image segmentation, real-time, prediction, AI, machine learning, Python, torch, inference
---

# Reference for `ultralytics/models/sam/predict.py`

!!! success "Improvements"

    This page is sourced from [https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/sam/predict.py](https://github.com/ultralytics/ultralytics/blob/main/ultralytics/models/sam/predict.py). Have an improvement or example to add? Open a [Pull Request](https://docs.ultralytics.com/help/contributing) — thank you! 🙏

<br>

## ::: ultralytics.models.sam.predict.Predictor

<br><br><hr><br>

## ::: ultralytics.models.sam.predict.SAM2Predictor

<br><br><hr><br>

## ::: ultralytics.models.sam.predict.SAM2VideoPredictor

<br><br><hr><br>

## ::: ultralytics.models.sam.predict.SAM2DynamicInteractivePredictor

<br><br><hr><br>

## ::: ultralytics.models.sam.predict.SAM3Predictor

<br><br><hr><br>

## ::: ultralytics.models.sam.predict.SAM3SemanticPredictor

<br><br><hr><br>

## ::: ultralytics.models.sam.predict.SAM3VideoPredictor

<br><br><hr><br>

## ::: ultralytics.models.sam.predict.SAM3VideoSemanticPredictor

<br><br>
