HumanSignal / HumanSignal/label-studio

Exporting to COCO does not include extra bbox labels

Open
#2,441 0 comments 1 reaction 1 assignee Claimed by @makseq View on GitHub
export feature images
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

**Describe the bug**
JSON after exporting to COCO does not contain extra bbox label info (see below steps)

**To Reproduce**
Steps to reproduce the behavior:
1. Create a new project
2. Add the following code xml (modified image bboxes label playground template)
```xml















```

4. Click Export -> COCO
5. See output

```json
{
"images": [
{
"width": 1000,
"height": 664,
"id": 0,
"file_name": "images/1/blabla1.jpg"
},
],
"categories": [
{
"id": 0,
"name": "aircraft"
},
{
"id": 1,
"name": "a"
},
{
"id": 2,
"name": "b"
},
{
"id": 3,
"name": "c"
},
{
"id": 4,
"name": "d"
},
],
"annotations": [
{
"id": 0,
"image_id": 0,
"category_id": 5,
"segmentation": [],
"bbox": [
153,
332,
1151,
296
],
"ignore": 0,
"iscrowd": 0,
"area": 340696
},
],
"info": {
"year": 2022,
"version": "1.0",
"description": "",
"contributor": "Label Studio",
"url": "",
"date_created": "2022-06-02 08:20:21.747930"
}
}
```

**Expected behavior**
There's no defined API to add extra annotations on bounding boxes for the COCO API, but:
- I would expect the extra labels per bbox (labels "a" and "b") to be contained in this JSON somehow.
- Most (if not all) COCO loader implementations would ignore extra fields in this json. For example, the annotation could look like:

```json
{
"id": 0,
"image_id": 0,
"category_id": 5,
"choices": {"my-secondary-category": { "category_id": <> }},
"segmentation": [],
"bbox": [
153,
332,
1151,
296
],
"ignore": 0,
"iscrowd": 0,
"area": 340696
}
```

Also, it doesn't make sense to bundle the categories created in the bbox choices (secondary ones), inside the main categories.

**Environment:**
- Label Studio Version : 1.4.1.post1

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.