Skip to main content
CVAT provides built-in format conversion through the Datumaro framework. This page covers converting between formats, handling format limitations, and best practices for dataset transformation.

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:
Command structure:
  • -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:
Considerations:
  • 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:
Considerations:
  • 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:
This happens automatically when exporting to:
  • COCO formats
  • YOLO Segmentation
  • Most segmentation formats

Track Keyframes

For video annotations, CVAT ensures track keyframes are set:
This ensures tracking annotations work correctly in imported formats.

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
Best practices:

YOLO Format

Limitations:
  • Only bounding boxes (classic YOLO) or polygons (Ultralytics)
  • No attribute support
  • Requires image dimensions for import
Best practices:

Pascal VOC

Limitations:
  • XML-based, less efficient for large datasets
  • Limited attribute support
  • Bounding boxes only (segmentation in separate format)
Best practices:

ImageNet

Limitations:
  • Classification only (no bounding boxes)
  • Directory-based organization
  • No spatial annotations
Best practices:

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:
  1. Check if target format supports the annotation type
  2. Verify labels exist in target format
  3. Check for invalid coordinates or empty annotations

Coordinate Mismatches

Problem: Bounding boxes or polygons are misplaced after conversion. Solutions:
  1. Verify image dimensions are correct
  2. Check coordinate normalization (YOLO uses normalized coords)
  3. Ensure coordinate systems match (some formats use different origins)

Label Mapping Errors

Problem: Labels are incorrectly mapped or missing. Solutions:
  1. Provide explicit label mapping
  2. Check for case sensitivity in label names
  3. Verify label IDs match between formats

Best Practices

  1. Always validate after conversion - Check statistics and sample images
  2. Preserve original datasets - Keep source data before conversion
  3. Use Datumaro format for intermediate storage - It preserves all information
  4. Test with small samples first - Verify conversion works before processing large datasets
  5. Document label mappings - Keep track of label changes between formats
  6. Handle edge cases - Empty annotations, overlapping regions, etc.
  7. Check format documentation - Understand target format limitations
  8. Use version control - Track dataset versions and conversions

Next Steps