Installation
Install the SDK with PyTorch support:torch- PyTorch frameworktorchvision- Computer vision utilitiesscikit-image- Image processingnumpy- Array operations
TaskVisionDataset
TheTaskVisionDataset class wraps a CVAT task as a PyTorch VisionDataset.
Basic Usage
Constructor Parameters
Client
required
Connected CVAT client instance
int
required
ID of the task to load
Callable
default:"None"
Transform function applied to both image and target. Takes
(image, target) and returns transformed (image, target).Callable
default:"None"
Transform function applied only to images
Callable
default:"None"
Transform function applied only to targets
Mapping[str, int]
default:"None"
Custom mapping from label names to indices. If not provided, labels are mapped to indices automatically.
UpdatePolicy
default:"IF_MISSING_OR_STALE"
When to update the local cache. Options:
IF_MISSING_OR_STALE, NEVER, ALWAYS.Working with Samples
Each sample is a tuple of(image, target):
Target Structure
TheTarget object contains frame annotations:
Custom Label Mapping
Control how label IDs map to indices:Transforms
Apply torchvision transforms:Joint Transforms
For transforms that need to modify both image and annotations:Caching Behavior
The dataset caches task data locally:Training Example: Object Detection
Training Example: Classification
Limitations
ProjectVisionDataset
For working with entire projects:Next Steps
- Auto-Annotation - Use trained models to auto-annotate tasks
- Core Operations - Manage tasks and annotations