HumanSignal / HumanSignal/label-studio
Label Studio COCO Import and Export Does Not Include Image Files
- Dominant language
- TypeScript
- Stars
- 28.3k
- Forks
- 3.7k
- Avg merge
- 14h
- Merged PRs (30d)
- 15
Description
## Description
I am using Label Studio to annotate an object-detection dataset that was originally downloaded from Roboflow in COCO format.
My goal is to maintain the dataset in Label Studio, continue adding new images and annotations over time, and eventually export the complete dataset with both **images and annotations** so that I can train an **RF-DETR object-detection model**.
However, after exporting the project from Label Studio, I receive the annotation JSON file, but the exported `images` folder is empty.
## Environment
* Label Studio version: `1.23.0`
* Operating system: Windows
* Dataset source: Roboflow
* Annotation types: `RectangleLabels` and `PolygonLabels`
* Project ID: `23`
* Project name: `aadhar_masking`
## 1. Original Dataset
I downloaded my dataset from Roboflow in COCO format.
The dataset contained separate splits:
```text
aadhar_detection_2.coco/
├── train/
│ ├── images
│ └── _annotations.coco.json
├── valid/
│ ├── images
│ └── _annotations.coco.json
└── test/
├── images
└── _annotations.coco.json
```
I wanted to import the existing COCO annotations into Label Studio instead of manually creating all the bounding boxes again.
## 2. COCO Import
I used `label-studio-converter` to convert the COCO annotations into Label Studio task JSON.
For example, for the training dataset:
```cmd
label-studio-converter import coco -i "C:\Users\Meet Suthar\Downloads\aadhar_detection_2.coco\train\_annotations.coco.json" -o "C:\Users\Meet Suthar\Downloads\train_tasks.json" --image-root-url "/data/local-files/?d=C:/Users/Meet Suthar/Downloads/aadhar_detection_2.coco/train/"
```
I did the same for `valid` and `test`.
The resulting tasks were successfully imported into Label Studio.
## 3. Labeling Interface
The project uses both polygon and rectangle annotations.
The labeling configuration contains 14 classes:
```xml
```
## 4. Local File Image Loading
The images were referenced using Label Studio's local-file mechanism:
```text
/data/local-files/?d=...
```
The images could be displayed inside Label Studio after enabling local file serving.
However, I noticed an important limitation when exporting the project.
## 5. Dataset Size
The project currently reports:
```text
Total tasks: 9470
Annotated tasks: 4735
Finished tasks: 4735
Useful annotations: 4735
```
Therefore, the project contains approximately:
```text
9470 total tasks
4735 annotated tasks
4735 unannotated tasks
```
I want to use the annotated data for RF-DETR training and continue adding more images and annotations to the same project.
## 6. Main Problem
When I export the dataset from Label Studio, I receive something similar to:
```text
export/
├── images/
│ └── [EMPTY]
└── result.json
```
The `result.json` file contains the task/annotation information, but the `images` directory does not contain the actual image files.
This means that I cannot directly use the exported dataset for RF-DETR training because RF-DETR requires both:
```text
Images
+
Annotations
```
The annotation JSON alone is not sufficient to train the model.
## 7. Important Observation
The task data contains image references such as:
```text
/data/local-files/?d=Users/Meet Suthar/...
```
This appears to reference files from the local machine rather than storing the actual image files inside the Label Studio project.
Therefore, when exporting the project, the annotations are exported but the actual image files are not included in the `images` directory.
## 8. New Images
I also started adding new images to the Label Studio project because I want this project to become an evolving dataset.
My intended workflow is:
```text
Upload images from computer
↓
Label in Label Studio
↓
Add more images
↓
Annotate new images
↓
Export complete dataset
↓
Images + annotations
↓
COCO dataset
↓
Train RF-DETR
```
However, even after adding new images, exporting the project still results in an `images` directory that does not contain the expected image files.
## 9. Expected Behavior
I would expect an export containing the annotated dataset to provide something similar to:
```text
dataset/
├── images/
│ ├── image001.jpg
│ ├── image002.jpg
│ ├── image003.jpg
│ └── ...
└── result.json
```
or another documented export structure where the actual image resources can be retrieved together with the annotations.
The goal is to obtain:
```text
Images
+
Corresponding annotations
```
so that the result can be converted into a proper COCO dataset and used for RF-DETR training.
## 10. Questions
I would like to understand:
1. If images are imported from a local Windows directory using `/data/local-files/?d=...`, are the image files actually stored by Label Studio or are only references stored?
2. Is there a supported way in Label Studio 1.23.0 to export a project containing both the annotations and the actual image files?
3. If I upload additional images directly into Label Studio, what is the recommended storage/import method so that the images can later be exported with the annotations?
4. What is the recommended workflow for maintaining a continuously growing object-detection dataset in Label Studio and periodically exporting the complete dataset for model training?
5. Is there a recommended export format or API workflow for obtaining the actual image resources together with the annotations?
6. If the original local images are no longer available on the machine, can Label Studio recover/download them if the tasks were created using local-file references?
## 11. Final Goal
The final goal is to use Label Studio as the continuously maintained annotation platform:
```text
Label Studio
│
┌──────────┴──────────┐
│ │
Images Annotations
│ │
└──────────┬──────────┘
↓
Complete Dataset
↓
COCO Format
↓
RF-DETR
↓
Object Detection Model
```
I would appreciate clarification on the correct way to store/import the images so that the complete dataset can later be exported with **both the image files and their annotations**.
Contributor guide
Research direction
Start by reproducing the export with the documented `/data/local-files/?d=...` task references in Label Studio 1.23.0, comparing the task data, `result.json`, and exported `images` directory. Trace the local-file storage and dataset export entry points; done means documenting whether referenced files are stored and defining a supported workflow or export path that produces retrievable images with their annotations.
Written by the indexing model from the issue text.
Assessment
- Domain
- computer-vision, data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100