# The YOLO export has incorrect label names and an altered category order compared to the original setup in Label Studio

**URL:** <https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339>\
**Category:** Label Studio Support\
**Created:** [September 11, 2024, 10:55am UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339 "2024-09-11T10:55:19Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vignesh\_S](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/vignesh_s/32/140_2.png) [@Vignesh\_S](https://community.labelstud.io/u/Vignesh_S)\
**Post date:** [September 11, 2024, 10:55am UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/1 "2024-09-11T10:55:19Z")

</div>

Hi Label studio Support Team,

1. Issue: After exporting, I noticed two significant issues:

(a)Label Name Mismatch: The label names in the YOLO file do not correspond to the expected class names. The labels in the YOLO file are incorrect for all classes.

(b)Category Order Change: The order of categories in the YOLO file has also changed compared to how they were set up in Label Studio.

The YOLO export has incorrect label names and altered category order compared to Label Studio, so please resolve this issue soon to ensure the file is correct.

Has anyone encountered similar issues or have any suggestions for troubleshooting? Your assistance would be greatly appreciated.  
Thank you!

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [September 11, 2024, 11:27am UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/2 "2024-09-11T11:27:19Z")

</div>

Hi,

try using `category` field on Label tags:

> **[Label Studio Documentation — Export Annotations](https://labelstud.io/guide/export#Question-3-How-to-modify-order-of-categories-for-COCO-and-YOLO-exports)**
>
> Label Studio documentation for exporting data labeling annotations to use in machine learning models and data science projects.

---

<div class="post-metadata">

**Author:** ![cheung\_fei](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/cheung_fei/32/149_2.png) [@cheung\_fei](https://community.labelstud.io/u/cheung_fei)\
**Post date:** [September 20, 2024, 10:02am UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/3 "2024-09-20T10:02:49Z")

</div>

Hi,

I am experiencing the same issues. Adding category tag does not work. I remember it does work in some previous version, but I forget which one is it.

Example:

```auto
{
  "categories": [
    {
      "id": "2",
      "name": "safe_b"
    },
    {
      "id": "0",
      "name": "safe_h"
    },
    {
      "id": "3",
      "name": "n_safe_b"
    },
    {
      "id": "1",
      "name": "n_safe_h"
    }
  ],
  "info": {
    "year": 2024,
    "version": "1.0",
    "contributor": "Label Studio"
  }
}

```

```auto
safe_b
safe_h
n_safe_b
n_safe_h

```

The correct order:

1. safe\_h
2. n\_safe\_h
3. safe\_b
4. n\_safe\_b

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [September 20, 2024, 12:23pm UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/4 "2024-09-20T12:23:01Z")

</div>

Could you please share your labeling config? And some sample of tasks in JSON format?

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [September 20, 2024, 12:42pm UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/5 "2024-09-20T12:42:23Z")

</div>

I’ve just checked it, everything works as expected:

If I use this simple labeling config:

```auto
<View>
  <Image name="image" value="$image"/>
  <RectangleLabels name="label" toName="image">
    <Label value="Airplane" background="green"/>
    <Label value="Car" background="blue"/>
  </RectangleLabels>
</View>

```

=\>

```auto
{
    "categories": [
        {
            "id": 0,
            "name": "Airplane"
        },
        {
            "id": 1,
            "name": "Car"
        }
    ],
    "info": {
        "year": 2024,
        "version": "1.0",
        "contributor": "Label Studio"
    }
}

```

If I use categories in the labeling config:

```auto
<View>
  <Image name="image" value="$image"/>
  <RectangleLabels name="label" toName="image">
    <Label value="Airplane" category="1" background="green"/>
    <Label value="Car" category="0" background="blue"/>
  </RectangleLabels>
</View>

```

=\>

```auto
{
    "categories": [
        {
            "id": "0",
            "name": "Car"
        },
        {
            "id": "1",
            "name": "Airplane"
        }
    ],
    "info": {
        "year": 2024,
        "version": "1.0",
        "contributor": "Label Studio"
    }
}

```

---

<div class="post-metadata">

**Author:** ![cheung\_fei](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/cheung_fei/32/149_2.png) [@cheung\_fei](https://community.labelstud.io/u/cheung_fei)\
**Post date:** [September 23, 2024, 1:21am UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/6 "2024-09-23T01:21:41Z")

</div>

The labeling config:

```auto
<View>
  <Image name="image" value="$image" zoom="true" zoomControl="true"/>
  <RectangleLabels name="label" toName="image">
  	<Label value="safe_h" category="0" background="#8ae234"/>
    <Label value="n_safe_h" category="1" background="#D4380D"/>
    <Label value="safe_b" category="2" background="#729fcf"/>
    <Label value="n_safe_b" category="3" background="#fcaf3e"/>
  </RectangleLabels>
</View>

```

Sample tasks

```auto
{
  "id": 697,
  "data": {
    "image": "http://192.168.51.22:9000/test_bucket/809c136a-0b0a-4721-9921-c96457dba180.jpg"
  },
  "annotations": [
    {
      "id": 593,
      "result": [],
      "created_username": " , 1",
      "created_ago": "5 days, 18 hours",
      "completed_by": {
        "id": 1,
        "first_name": "",
        "last_name": "",
        "avatar": null,
        "email": "",
        "initials": "yf"
      },
      "was_cancelled": false,
      "ground_truth": false,
      "created_at": "2024-09-17T06:35:00.546917Z",
      "updated_at": "2024-09-17T07:05:14.718511Z",
      "draft_created_at": null,
      "lead_time": 15.008,
      "import_id": null,
      "last_action": null,
      "task": 697,
      "project": 2,
      "updated_by": 4,
      "parent_prediction": null,
      "parent_annotation": null,
      "last_created_by": null
    }
  ],
  "predictions": []
}{
  "id": 697,
  "data": {
    "image": "http://192.168.51.22:9000/test_bucket/809c136a-0b0a-4721-9921-c96457dba180.jpg"
  },
  "annotations": [
    {
      "id": 593,
      "result": [],
      "created_username": ", 1",
      "created_ago": "5 days, 18 hours",
      "completed_by": {
        "id": 1,
        "first_name": "",
        "last_name": "",
        "avatar": null,
        "email": "",
        "initials": "yf"
      },
      "was_cancelled": false,
      "ground_truth": false,
      "created_at": "2024-09-17T06:35:00.546917Z",
      "updated_at": "2024-09-17T07:05:14.718511Z",
      "draft_created_at": null,
      "lead_time": 15.008,
      "import_id": null,
      "last_action": null,
      "task": 697,
      "project": 2,
      "updated_by": 4,
      "parent_prediction": null,
      "parent_annotation": null,
      "last_created_by": null
    }
  ],
  "predictions": []
}

```

I suspect it is because I added the category tag after I label the project.

---

<div class="post-metadata">

**Author:** ![cheung\_fei](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/cheung_fei/32/149_2.png) [@cheung\_fei](https://community.labelstud.io/u/cheung_fei)\
**Post date:** [September 23, 2024, 2:53am UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/7 "2024-09-23T02:53:41Z")

</div>

I have double check the exported label in yolo format. The class id does not match the original order, nor the exported order.

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [September 23, 2024, 1:13pm UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/8 "2024-09-23T13:13:03Z")

</div>

what LS version you are using?

---

<div class="post-metadata">

**Author:** ![makseq](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/makseq/32/26_2.png) [@makseq](https://community.labelstud.io/u/makseq)\
**Post date:** [September 23, 2024, 1:16pm UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/9 "2024-09-23T13:16:33Z")

</div>

also you sent annotations without any regions in incorrect json format.

---

<div class="post-metadata">

**Author:** ![cheung\_fei](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.labelstud.io/cheung_fei/32/149_2.png) [@cheung\_fei](https://community.labelstud.io/u/cheung_fei)\
**Post date:** [September 24, 2024, 3:30am UTC](https://community.labelstud.io/t/the-yolo-export-has-incorrect-label-names-and-an-altered-category-order-compared-to-the-original-setup-in-label-studio/339/10 "2024-09-24T03:30:58Z")

</div>

I am using `heartexlabs/label-studio:latest`.  
`label-studio version`

```auto
{
    "release": "1.13.1",
    "label-studio-os-package": {
        "version": "1.13.1",
        "short_version": "1.13",
        "latest_version_from_pypi": "1.13.1",
        "latest_version_upload_time": "2024-08-20T17:38:07",
        "current_version_is_outdated": false
    },
    "label-studio-os-backend": {
        "message": "ci: Build frontend",
        "commit": "d9b816a3781ee806bba50c8c5589fcdb8555a277",
        "date": "2024/08/19 19:14:23",
        "branch": "",
        "version": "1.13.1+0.gd9b816a"
    },
    "label-studio-frontend": {
        "message": "fix: LEAP-762: Fix offsets in domManager for emojis (#6135)",
        "commit": "8d8a7fce72b808d00f94cc10b49669121d186c1f",
        "date": "2024-08-01T03:08:02.000Z",
        "branch": "develop"
    },
    "dm2": {
        "message": "chore: OPTIC-866: Stylus to Sass conversion LS web/libs/datamanager/sr ...",
        "commit": "8fbedaa6fdd00338da19c258a798b8799f0cd935",
        "date": "2024-07-26T15:12:41.000Z",
        "branch": "develop"
    },
    "label-studio-converter": {
        "version": "1.0.5"
    }
}

```

For the annotations, please kindly check the following one:

````auto
{
  "id": 728,
  "data": {
    "image": "http://192.168.51.22:9000/test_bucket/40dfdea-c7dd-4ae8-9776-b9efc1c28a2e.jpg"
  },
  "annotations": [
    {
      "id": 383,
      "result": [
        {
          "type": "rectanglelabels",
          "value": {
            "x": 75.87505,
            "y": 9.589049999999999,
            "width": 21.4375,
            "height": 76.3387,
            "rectanglelabels": [
              "n_safe_b"
            ]
          },
          "origin": "manual",
          "to_name": "image",
          "from_name": "label",
          "original_width": 1280,
          "original_height": 720
        }
      ],
      "created_username": "",
      "created_ago": "6 days, 21 hours",
      "completed_by": null,
      "was_cancelled": false,
      "ground_truth": false,
      "created_at": "2024-09-17T05:34:51.721259Z",
      "updated_at": "2024-09-17T05:34:51.721268Z",
      "draft_created_at": null,
      "lead_time": null,
      "import_id": null,
      "last_action": null,
      "task": 728,
      "project": 2,
      "updated_by": 1,
      "parent_prediction": null,
      "parent_annotation": null,
      "last_created_by": null
    }
  ],
  "predictions": []
}```
````
