ryouchinsa / Rectlabel-support

RectLabel is an offline image annotation tool for object detection and segmentation.
https://rectlabel.com
515 stars 73 forks source link

createML JSON format #232

Closed khilller closed 1 year ago

khilller commented 1 year ago

Hey, There seems to be an issue with the JSON file format. Its being exported as [{"annotations":[],"image":"0-b.jpg"} (annotation first and then image name) as compared to the required format of [{"image":"1_png.rf.0b5da0f0f70755915bfbce3852d2e70b.jpg","annotations":[{"label":"court","coordinates":{"x":442.17391299999997,"y":269.347826,"width":822.608696,"height":211.73913000000002}}]} (image name first and then annotation). I dont know if I'm doing something wrong or a setting needs to be changed. Please advice.

rromanchuk commented 1 year ago

@khilller the order of keys is NOOP, he's just alpha sorting the keys like a good netizen

rromanchuk commented 1 year ago

Also, there is no key image, it's imagefilename

[{
  "imagefilename": "breakfast_0.png",
  "annotation": [
    {
      "coordinates": {
        "y": 156.062,
        "x": 195.122,
        "height": 148.872,
        "width": 148.03
      },
      "label": "Waffle"
    }
  ]
}]

https://developer.apple.com/documentation/createml/building-an-object-detector-data-source

khilller commented 1 year ago

@rromanchuk You're right! its imagefilename, but suprisingly the key:image worked for me. Do you reckon a workaround for sorting the keys as per these docs?

khilller commented 1 year ago

@rromanchuk I totally missed 'NOOP'. I'm a noob, but i understand now. The JSON was missing a label attribute which was why coreML was throwing and error. But it works now. Thank you

rromanchuk commented 1 year ago

@khilller it's generally a mess 🤣 and poorly documented

With Sonoma/CreateML 5, there's even a new new json schema, well at least an arbitrary half-example for training in swift. https://developer.apple.com/documentation/CreateML/creating-a-multi-label-image-classifier If you browse the developer forums you will find you are not alone.