Exciting news! You can now perform inference with Segment Anything-2 models using the Ultralytics package.
Both Python and CLI support are available.
Perform inference with a SAM 2 model
from ultralytics import SAM
model = SAM("sam2_b.pt") # Load a model
model("path/to/video.mp4") # Run inference
A big thanks to Laughing-q for adding support for SAM2 in Ultralytics!