Overview
- Path type: JSON file (
.json) - Lossiness: Conditional (see below)
- Bbox format: Pixel-space XYWH
[x, y, width, height] - Use case: Industry standard, model training, benchmarking
Key Features
✓ Preserves dataset info and metadata✓ Preserves licenses
✓ Preserves image metadata
✓ Preserves category supercategory
✓ Maps
score to/from IR confidence✓ Deterministic output (sorted by IDs)
⚠️
segmentation data accepted but ignored (detection-only)⚠️
iscrowd and area stored as annotation attributes
Bounding Box Format
COCO uses pixel-space XYWH format:x: Top-left X coordinate in pixelsy: Top-left Y coordinate in pixelswidth: Box width in pixelsheight: Box height in pixels
Example
- xmin = x = 10.0
- ymin = y = 20.0
- xmax = x + width = 10.0 + 90.0 = 100.0
- ymax = y + height = 20.0 + 60.0 = 80.0
Structure
Lossiness Details
COCO is conditionally lossless:Preserved ✓
- Dataset info (year, version, description, contributor, url, date_created)
- Licenses (id, name, url)
- Image metadata (id, width, height, file_name, license, date_captured)
- Categories (id, name, supercategory)
- Bounding boxes (XYWH ↔ XYXY conversion)
- Confidence (
score↔ IRconfidence) - Area and iscrowd (stored as annotation attributes)
Not Preserved ✗
- Custom annotation attributes (except
iscrowdandarea) - Custom image attributes
- Segmentation data (accepted on read but dropped)
Reader Behavior
- Accepts standard COCO JSON structure
- Converts XYWH bboxes to IR XYXY via bbox helpers
- Maps
scorefield to IRconfidence - Stores
iscrowdas annotation attribute"iscrowd" - Stores
areaas annotation attribute"area"(for round-trip preservation) - Accepts
segmentationbut ignores/drops it
Writer Behavior
- Produces deterministic output (sorted by ID)
- Converts IR XYXY to COCO XYWH
- Maps IR
confidencetoscore - Retrieves
iscrowdfrom annotation attributes (default: 0) - Retrieves
areafrom annotation attributes (falls back to computed bbox area) - Emits
segmentationas empty array[] - Sorts all lists by ID for stable output
Confidence/Score Mapping
COCOscore field maps to/from IR confidence:
Reading:
Usage
Read COCO
Write COCO
Auto-detection
Panlabel auto-detects COCO format from file content:Round-trip Behavior
COCO → IR → COCO conversions preserve:- All standard COCO fields
- Bbox coordinates (within floating-point precision)
- IDs, category names, image metadata
areaandiscrowdvalues
See Also
IR JSON Format
Lossless canonical format
Format Overview
Compare all supported formats