diff command performs semantic comparison between two annotation datasets, identifying differences in images, annotations, and categories.
Usage
Parameters
Path to the first dataset.
Path to the second dataset.
Format of the first input dataset.Supported values:
auto, ir-json, coco, cvat, label-studio, tfod, yolo, vocFormat of the second input dataset.Supported values:
auto, ir-json, coco, cvat, label-studio, tfod, yolo, vocStrategy for matching annotations between datasets.Options:
id- Match annotations by their ID fieldiou- Match annotations by Intersection over Union (spatial overlap)
iou when annotation IDs are not consistent between datasets.IoU threshold for matching when using
--match-by iou.Must be in the range (0.0, 1.0]. Higher values require more overlap to consider annotations as matching.Common values:0.5- Standard object detection threshold0.75- Stricter matching requirement0.9- Very strict, nearly exact overlap required
Include item-level details in the output.When enabled, shows specific differences for each image and annotation rather than just summary counts.
Output format for the diff report.Options:
text- Human-readable reportjson- Machine-readable JSON
Matching Strategies
ID Matching (--match-by id)
Matches annotations based on their unique ID field. Best when:
- Comparing versions of the same dataset
- IDs are stable across versions
- You want to track changes to specific annotations
- Datasets must have unique image file names
- Annotation IDs should be consistent
IoU Matching (--match-by iou)
Matches annotations based on spatial overlap (Intersection over Union). Best when:
- Comparing annotations from different sources
- IDs are not consistent or meaningful
- You care about spatial agreement rather than ID correspondence
- For each annotation in dataset A, find the best-matching annotation in dataset B (same image, same category)
- If IoU ≥ threshold, consider them matching
- Report unmatched, matched, and modified annotations
Examples
Basic Diff with ID Matching
IoU-Based Comparison
Detailed Diff Report
Cross-Format Comparison
JSON Output for Automation
Auto-Detection
Output Examples
Text Report (Summary)
Text Report (Detailed)
JSON Report Structure
Use Cases
Track Annotation Changes
Compare Annotators
Verify Conversion Accuracy
CI/CD Quality Gates
Dataset Merge Validation
Important Notes
The
--iou-threshold parameter only applies when using --match-by iou. It is ignored when using --match-by id.Exit Codes
0- Diff completed successfully (differences may or may not exist)1- Error occurred (format detection failed, invalid threshold, duplicate file names, etc.)
See Also
Stats Command
Analyze individual datasets
Validate Command
Validate datasets before comparison