HumanSignal / label-studio-converter

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

COCO Export: the 'file_name' of image in label differs from actual file #139

Closed JamboChen closed 1 year ago

JamboChen commented 2 years ago

the actual image is: "images\90fbb0c7-a.jpg", but in result.json the 'file_name' of image is "images\1/90fbb0c7-a.jpg". It seems contain the project id.

  "images": [
    {
      "width": 210,
      "height": 240,
      "id": 0,
      "file_name": "images\\1/90fbb0c7-a.jpg"
    },

after change the code https://github.com/heartexlabs/label-studio-converter/blob/87180cd3bbd9663bd19f9feeb65ec6d3c4aadedb/label_studio_converter/utils.py#L129 to

            return os.path.join(os.path.basename(output_dir), os.path.basename(filename))

it becomes normal

"images": [
    {
      "width": 210,
      "height": 240,
      "id": 0,
      "file_name": "images\\90fbb0c7-a.jpg"
    },
KonstantinKorotaev commented 2 years ago

Applied your fix, please update your label-studio-converter to 0.0.45.rc5

makseq commented 1 year ago

Closed as unanswered. Fixed in https://github.com/heartexlabs/label-studio-converter/commit/7598b56db403aafa7c88767af388941bb8281347.