Is there a way to get ULTRALYTICS SAM or SAM2 to provide the top 3 masks when prompted by a single point, the same way it happens on the original paper
from ultralytics import SAM
model = SAM("sam2.1_t.pt")
# This returns a list of lenght==0
results = model.predict("path/to/image.jpg", points=[900, 370], labels=[1])
from ultralytics import SAM
model = SAM("sam2.1_t.pt")
# This returns a list of lenght==0
results = model.predict("debug/images/cars_people_720p.jpg", points=[200, 370], labels=[1])
# this does not work
results = model.predict("debug/images/cars_people_720p.jpg", points=[200, 370], labels=[1], multimask_output=True)
$ py test_sam.py
...
SyntaxError: 'multimask_output' is not a valid YOLO argument.
Arguments received: ['yolo']. Ultralytics 'yolo' commands use the following syntax:
yolo TASK MODE ARGS
Where TASK (optional) is one of ['obb', 'pose', 'detect', 'classify', 'segment']
MODE (required) is one of ['train', 'val', 'benchmark', 'export', 'predict', 'track']
ARGS (optional) are any number of custom 'arg=value' pairs like 'imgsz=320' that override defaults.
See all ARGS at https://docs.ultralytics.com/usage/cfg or with 'yolo cfg'
1. Train a detection model for 10 epochs with an initial learning_rate of 0.01
yolo train data=coco8.yaml model=yolo11n.pt epochs=10 lr0=0.01
2. Predict a YouTube video using a pretrained segmentation model at image size 320:
yolo predict model=yolo11n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
3. Val a pretrained detection model at batch-size 1 and image size 640:
yolo val model=yolo11n.pt data=coco8.yaml batch=1 imgsz=640
4. Export a YOLO11n classification model to ONNX format at image size 224 by 128 (no TASK required)
yolo export model=yolo11n-cls.pt format=onnx imgsz=224,128
5. Ultralytics solutions usage
yolo solutions count or in ['crop', 'blur', 'workout', 'heatmap', 'isegment', 'visioneye', 'speed', 'queue', 'analytics', 'inference', 'trackzone'] source="path/to/video.mp4"
6. Run special commands:
yolo help
yolo checks
yolo version
yolo settings
yolo copy-cfg
yolo cfg
yolo solutions help
Docs: https://docs.ultralytics.com
Solutions: https://docs.ultralytics.com/solutions/
Community: https://community.ultralytics.com
GitHub: https://github.com/ultralytics/ultralytics
from ultralytics import SAM
model = SAM("sam2.1_t.pt")
model() # creates predictor. run once after model load
results = model.predictor("ultralytics/assets/bus.jpg", points=[200, 370], labels=[1], multimask_output=True)
SyntaxError: 'multimask_output' is not a valid YOLO argument.
Arguments received: ['yolo']. Ultralytics 'yolo' commands use the following syntax:
yolo TASK MODE ARGS
Where TASK (optional) is one of ['segment', 'detect', 'classify', 'pose', 'obb']
MODE (required) is one of ['predict', 'train', 'export', 'benchmark', 'track', 'val']
ARGS (optional) are any number of custom 'arg=value' pairs like 'imgsz=320' that override defaults.
See all ARGS at https://docs.ultralytics.com/usage/cfg or with 'yolo cfg'
1. Train a detection model for 10 epochs with an initial learning_rate of 0.01
yolo train data=coco8.yaml model=yolo11n.pt epochs=10 lr0=0.01
2. Predict a YouTube video using a pretrained segmentation model at image size 320:
yolo predict model=yolo11n-seg.pt source='https://youtu.be/LNwODJXcvt4' imgsz=320
3. Val a pretrained detection model at batch-size 1 and image size 640:
yolo val model=yolo11n.pt data=coco8.yaml batch=1 imgsz=640
4. Export a YOLO11n classification model to ONNX format at image size 224 by 128 (no TASK required)
yolo export model=yolo11n-cls.pt format=onnx imgsz=224,128
5. Ultralytics solutions usage
yolo solutions count or in ['crop', 'blur', 'workout', 'heatmap', 'isegment', 'visioneye', 'speed', 'queue', 'analytics', 'inference', 'trackzone'] source="path/to/video.mp4"
6. Run special commands:
yolo help
yolo checks
yolo version
yolo settings
yolo copy-cfg
yolo cfg
yolo solutions help
Docs: https://docs.ultralytics.com
Solutions: https://docs.ultralytics.com/solutions/
Community: https://community.ultralytics.com
GitHub: https://github.com/ultralytics/ultralytics