HumanSignal / HumanSignal/label-studio

[COCO Export] Category IDs mismatch and file_name uses internal Label Studio storage paths

Open
#9,366 2 comments 0 reactions 0 assignees View on GitHub
community_investigate
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Describe the bug**
COCO export produces incorrect category handling and incorrect image file paths.

Specifically:
1. COCO export does not respect category ordering / mapping even when category attribute is defined in the labeling config.
2. YOLO export works perfectly with the same project and same labeling config.
3. COCO export with images generates incorrect file_name paths pointing to internal Label Studio storage instead of dataset-relative paths.

**To Reproduce**
Steps to reproduce the behavior:
1. Create a Label Studio project using RectangleLabels.
2. Define labels with explicit category attributes in labeling config.
3. Export using:
• COCO
• COCO with images
• YOLO (for comparison)

Example labeling config:
```



```

4. Inspect exported JSON.

**Observed behavior**
❌ Category issues (COCO only)
• COCO export does not respect category mapping defined in config.
• Category IDs appear reordered or reassigned.
• Happens across multiple projects with identical configs.

✅ YOLO Export
• Category mapping and ordering are correct.
• No issues observed.

❌ Image path issue (COCO with images)

COCO export generates:
```
"file_name": "../../label-studio/data/media/upload/26/6277b484-rsz_1img_9005.jpg"
```

Instead of something dataset-relative like:
```
"file_name": "images/6277b484-rsz_1img_9005.jpg"
````

This makes the dataset harder to use directly for training pipelines and breaks portability.

**Observed behavior**

Categories
• COCO export should respect category attribute defined in labeling config.
• Category IDs should be stable and predictable across projects when config is identical.

Image Paths
• COCO with images export should use dataset-relative paths.
• Example: `images/.jpg`
• Should not reference internal Label Studio storage paths.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environment (please complete the following information):**
- OS: Docker linux
- Label Studio Version: latest - 1.22.0

**Additional context**
This issue happens consistently across multiple projects with identical labeling configs.

YOLO export works correctly, which suggests the issue is specific to the COCO export pipeline.

This affects downstream ML training because:
• Category mismatch causes incorrect class mapping.
• File path format requires manual post-processing before training.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.