Installation
For auto-annotation with built-in functions, install the pytorch extra:Overview
The auto-annotation system supports two types of functions:- Detection Functions: Apply a model independently to each frame
- Tracking Functions: Track shapes across multiple frames
Detection Functions
Detection functions process each image independently and return annotations.Using annotate_task
The main entry point for auto-annotation:Function Parameters
Client
required
Connected CVAT client
int
required
ID of the task to annotate
DetectionFunction
required
Detection function to apply
ProgressReporter
default:"None"
Progress reporter for tracking progress
bool
default:"False"
If
True, remove existing annotations before adding new onesbool
default:"False"
If
True, ignore function labels not in the task. If False, raise error.float | None
default:"None"
Confidence threshold (0-1) passed to the function. Function may apply its own default.
bool
default:"False"
If
True, function must convert mask shapes to polygonsCreating Detection Functions
Function Interface
A detection function must implement theDetectionFunction protocol:
Detection Function Spec
The spec defines what labels your function supports:Creating Annotations
Use helper functions to create annotations:Detection Function Context
The context provides frame-specific information:Built-in Detection Functions
The SDK includes Torchvision-based detection functions:Object Detection
Instance Segmentation
Classification
Keypoint Detection
Custom Model Example
Here’s a complete example with a custom YOLOv5 model:Label Mapping
When your function labels don’t exactly match task labels:Progress Reporting
Track progress with tqdm:Error Handling
Limitations
Best Practices
- Test on Small Tasks: Start with a small task to verify your function works correctly
- Use Confidence Thresholds: Set appropriate confidence thresholds to filter low-quality predictions
-
Clear Existing Annotations Carefully: Use
clear_existing=Trueonly when you’re sure -
Handle Label Mapping: Ensure your function labels match task labels, or use
allow_unmatched_labels=True - Monitor Progress: Use progress reporters for long-running operations
-
Validate Spec: Make sure your
DetectionFunctionSpechas unique IDs and valid attributes
Next Steps
- PyTorch Adapter - Train models on CVAT data
- Core Operations - Manage annotations programmatically