Overview
Format conversion is needed when:- Your ML framework requires a specific format
- Source annotations are in a different format
- Converting between annotation types (e.g., masks to polygons)
- Merging datasets from different sources
- Adapting to format-specific limitations
Using Datumaro for Conversion
Datumaro is CVAT’s built-in dataset framework that handles all format conversions.Installation
Basic Conversion
Convert between any supported formats:-if: Input format-i: Input directory-f: Output format-o: Output directory
Python API Conversion
Programmatic format conversion:Batch Conversion
Convert to multiple formats:Common Conversion Scenarios
COCO to YOLO
Convert COCO object detection to YOLO format:- COCO polygons are converted to bounding boxes
- Category IDs are remapped to YOLO class indices
- Coordinate normalization is handled automatically
YOLO to COCO
Convert YOLO to COCO for modern frameworks:- YOLO bounding boxes become COCO bbox annotations
- Class names from obj.names are preserved
- Image dimensions required for conversion
Pascal VOC to COCO
Convert VOC XML annotations to COCO JSON:Masks to Polygons
Convert segmentation masks to polygon annotations:Polygons to Masks
Convert polygons to pixel-level masks:Bounding Boxes to Polygons
Convert boxes to polygon representations:CVAT-Specific Conversions
When exporting from CVAT, certain conversions happen automatically:Ellipses to Masks
CVAT ellipses are automatically converted to masks for formats that don’t support ellipses:- COCO formats
- YOLO Segmentation
- Most segmentation formats
Track Keyframes
For video annotations, CVAT ensures track keyframes are set:Dataset Transformations
Datumaro provides powerful transformations beyond format conversion:Filtering
Filter dataset by various criteria:Sampling
Create dataset subsets:Label Mapping
Rename or merge labels:Image Resizing
Resize images and adjust annotations:Annotation Normalization
Normalize annotations for consistency:Format-Specific Considerations
COCO Format
Limitations:- No native support for ellipses (converted to masks/polygons)
- Rotated boxes require polygon representation
- Attributes stored as custom fields
YOLO Format
Limitations:- Only bounding boxes (classic YOLO) or polygons (Ultralytics)
- No attribute support
- Requires image dimensions for import
Pascal VOC
Limitations:- XML-based, less efficient for large datasets
- Limited attribute support
- Bounding boxes only (segmentation in separate format)
ImageNet
Limitations:- Classification only (no bounding boxes)
- Directory-based organization
- No spatial annotations
Handling Annotation Type Mismatches
When converting between formats with different annotation types:Detection to Segmentation
Convert bounding boxes to masks:Segmentation to Detection
Convert masks to bounding boxes:Keypoints to Detection
Extract bounding boxes from keypoint annotations:Validation and Quality Checks
Validate converted datasets:Troubleshooting
Missing Annotations After Conversion
Problem: Some annotations disappeared after conversion. Solutions:- Check if target format supports the annotation type
- Verify labels exist in target format
- Check for invalid coordinates or empty annotations
Coordinate Mismatches
Problem: Bounding boxes or polygons are misplaced after conversion. Solutions:- Verify image dimensions are correct
- Check coordinate normalization (YOLO uses normalized coords)
- Ensure coordinate systems match (some formats use different origins)
Label Mapping Errors
Problem: Labels are incorrectly mapped or missing. Solutions:- Provide explicit label mapping
- Check for case sensitivity in label names
- Verify label IDs match between formats
Best Practices
- Always validate after conversion - Check statistics and sample images
- Preserve original datasets - Keep source data before conversion
- Use Datumaro format for intermediate storage - It preserves all information
- Test with small samples first - Verify conversion works before processing large datasets
- Document label mappings - Keep track of label changes between formats
- Handle edge cases - Empty annotations, overlapping regions, etc.
- Check format documentation - Understand target format limitations
- Use version control - Track dataset versions and conversions
Next Steps
- Import & Export - Learn how to use converted datasets
- Supported Formats - Details on each format
- Datumaro Documentation - Advanced transformations
- Datumaro CLI Reference - Complete command list