HumanSignal / label-studio-converter

Tools for converting Label Studio annotations into common dataset formats
https://labelstud.io/
255 stars 132 forks source link

YOLO exporter overwrite annotation of image with the same filename #132

Closed rgaiacs closed 1 year ago

rgaiacs commented 1 year ago

Consider a project that has the following tasks:

Image
http://localhost:8081/foo/0000.jpeg
http://localhost:8081/bar/0000.jpeg

the content of the zip file exported in the YOLO format is

  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2022-10-13 08:46   images/
        0  2022-10-13 08:46   labels/
      164  2022-10-13 08:46   notes.json
        5  2022-10-13 08:46   classes.txt
   178423  2022-10-13 08:46   images/0000_7436.jpeg
   178423  2022-10-13 08:46   images/0000_6dd1.jpeg
       78  2022-10-13 08:46   labels/0000.txt
---------                     -------
   357093                     7 files

It only has one annotation (0000.txt) but it should have two: (0000_7436.txt and 0000_6dd1.txt).

JSON

[
    {
        "id": 51408,
        "annotations": [
            {
                "id": 36032,
                "completed_by": 1,
                "result": [
                    {
                        "original_width": 1554,
                        "original_height": 2321,
                        "image_rotation": 0,
                        "value": {
                            "x": 24.13333333333333,
                            "y": 64.01785714285711,
                            "width": 16.80000000000002,
                            "height": 20.53571428571431,
                            "rotation": 0,
                            "rectanglelabels": [
                                "Bone"
                            ]
                        },
                        "id": "jZrpApcJXa",
                        "from_name": "label",
                        "to_name": "image",
                        "type": "rectanglelabels",
                        "origin": "manual"
                    }
                ],
                "was_cancelled": false,
                "ground_truth": false,
                "created_at": "2022-10-13T08:27:27.856366Z",
                "updated_at": "2022-10-13T08:27:27.856405Z",
                "lead_time": 18.995,
                "prediction": {},
                "result_count": 0,
                "task": 51408,
                "parent_prediction": null,
                "parent_annotation": null
            }
        ],
        "file_upload": "38b53a26-tasks.csv",
        "drafts": [],
        "predictions": [],
        "data": {
            "image": "http://localhost:8081/foo/0000.jpeg"
        },
        "meta": {},
        "created_at": "2022-10-13T08:26:35.607099Z",
        "updated_at": "2022-10-13T08:26:35.607123Z",
        "inner_id": 0,
        "total_annotations": 1,
        "cancelled_annotations": 0,
        "total_predictions": 0,
        "comment_count": 0,
        "unresolved_comment_count": 0,
        "last_comment_updated_at": null,
        "project": 62,
        "updated_by": null,
        "comment_authors": []
    },
    {
        "id": 51407,
        "annotations": [
            {
                "id": 36031,
                "completed_by": 1,
                "result": [
                    {
                        "original_width": 1554,
                        "original_height": 2321,
                        "image_rotation": 0,
                        "value": {
                            "x": 48.21084582439114,
                            "y": 69.31097587777,
                            "width": 10.833336413509874,
                            "height": 19.159309572697985,
                            "rotation": 299.24136983222786,
                            "rectanglelabels": [
                                "Bone"
                            ]
                        },
                        "id": "nV-FejNBOl",
                        "from_name": "label",
                        "to_name": "image",
                        "type": "rectanglelabels",
                        "origin": "manual"
                    }
                ],
                "was_cancelled": false,
                "ground_truth": false,
                "created_at": "2022-10-13T08:27:05.393445Z",
                "updated_at": "2022-10-13T08:27:05.393494Z",
                "lead_time": 27.559,
                "prediction": {},
                "result_count": 0,
                "task": 51407,
                "parent_prediction": null,
                "parent_annotation": null
            }
        ],
        "file_upload": "38b53a26-tasks.csv",
        "drafts": [],
        "predictions": [],
        "data": {
            "image": "http://localhost:8081/bar/0000.jpeg"
        },
        "meta": {},
        "created_at": "2022-10-13T08:26:35.607001Z",
        "updated_at": "2022-10-13T08:26:35.607039Z",
        "inner_id": 0,
        "total_annotations": 1,
        "cancelled_annotations": 0,
        "total_predictions": 0,
        "comment_count": 0,
        "unresolved_comment_count": 0,
        "last_comment_updated_at": null,
        "project": 62,
        "updated_by": null,
        "comment_authors": []
    }
]

COCO

  Length      Date    Time    Name
---------  ---------- -----   ----
        0  2022-10-13 08:46   images/
      992  2022-10-13 08:46   result.json
   178423  2022-10-13 08:46   images/0000_7436.jpeg
   178423  2022-10-13 08:46   images/0000_6dd1.jpeg
---------                     -------
   357838                     4 files
KonstantinKorotaev commented 1 year ago

Hi @rgaiacs Could you please update your instance to label-studio-converter 0.0.45rc4 and try one more time?

rgaiacs commented 1 year ago

Thanks for the fix.