Reference for ultralytics/data/annotator.py
Note
Full source code for this file is available at https://github.com/ultralytics/ultralytics/blob/main/ultralytics/data/annotator.py. Help us fix any issues you see by submitting a Pull Request 🛠️. Thank you 🙏!
ultralytics.data.annotator.auto_annotate(data, det_model='yolov8x.pt', sam_model='sam_b.pt', device='', output_dir=None)
Automatically annotates images using a YOLO object detection model and a SAM segmentation model.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
str
|
Path to a folder containing images to be annotated. |
required |
det_model |
str
|
Pre-trained YOLO detection model. Defaults to 'yolov8x.pt'. |
'yolov8x.pt'
|
sam_model |
str
|
Pre-trained SAM segmentation model. Defaults to 'sam_b.pt'. |
'sam_b.pt'
|
device |
str
|
Device to run the models on. Defaults to an empty string (CPU or GPU, if available). |
''
|
output_dir |
str | None | optional
|
Directory to save the annotated results. Defaults to a 'labels' folder in the same directory as 'data'. |
None
|