Create ML training error Unexpected JPEG decode failure

Hi, I'm trying to build an object detector model using create ml. After a lot of exploration, I figured the annotation.json format which is expected by the training input. It's something like this:



[{"image":"orange_1.jpg",

     "annotations":[

     {"label":"orange","coordinates":{"y":1132,"x":781,"width":413,"height":394}},

     {"label":"orange","coordinates":{"y":1167,"x":308,"width":397,"height":375}}

      ]

     }
]


On running the training, I get the following error:

Training Error. Unxpected JPEG decode failure.


I confirm that the file name is exactly the same in the training folder.


Any leads on how to go about this?

Post not yet marked as solved Up vote post of allie123 Down vote post of allie123
2.0k views

Replies

That is actually not the correct JSON format for an object detector, the correct format can be found at this link:

https://developer.apple.com/documentation/createml/mlobjectdetector/datasource

  • And where on this page we can see a correct json example?

  • Second @Yauhen_P

Add a Comment

Hi, I tried following the naming conventions from the docs link you shared. Still no luck 😟


[
  {
    "imagefilename": "orange_1.jpg",
    "annotation": [
      {
        "label": "orange",
        "coordinates": {
          "y": 400,
          "x": 400,
          "height": 394,
          "width": 413
        }
      },
      {
        "label": "orange",
        "coordinates": {
          "y": 167,
          "x": 108,
          "height": 375,
          "width": 397
        
        }
      }
    ]
  }
]


Also, it says unexpected JPEG decode error once the training starts.

I got the same error, I checked the type of images that I got downloaded from the internet, so before that I was naming my images, for example,

cat.0.jpg

cat.1.jpg

....

..

cat.100.jpg

However, After getting the error, I read the info of some images, I found all images are jpg types from the original source, for example,

https://cdn.pixabay.com/photo/2016/09/13/05/47/gears-1666494__340.jpg

And I found five images were png types, like this:

https://cdn.pixabay.com/photo/2017/08/19/23/54/email-sign-2660276__340.png

So, I changed these to,

cat.55.png

cat.34.png


And jumped to the create ML againg hitting the start training button, it runs correctly, but I realized that these 5 images of type png are not recognizable from create ML at all so replace with other data of type jpg.

Hope this helps anyone will have the same error!