Q: How to used cropped images in Create ML as Object Detection training data without JSON annotation

I have hundreds of thousands of image files that are cropped images grouped into class folders appropriately that I would like to use in Create ML to training an object detection model.

I do not have .json annotation files for any of those cropped images.

Q1: Am I required to create the .json annotation file for each individual image and just set the bounding box coordinates to the four corners of the images since the full image is the object already cropped? Or is there a way to leverage what I have directly without creating all those .json files?

Q2: Anyone have a handy script to help automated the creation of those files? :-)

Thanks everyone.

Answered by brockgs in 689742022

For what it's worth, I created a quick and dirty little shell script to create the annotation file expected by Create ML for all my already cropped images. In my case, since the filename for each image has the class identified by the first 4 letters of the filename, my script copies that out to put into the class field for each image file annotation. I just divide the width and height of the image file by two to get the centre point as x and y, again to suite the structure of these annotations.

After running it in one of my directories containing just under 40,000 cropped images, it output a perfectly valid annotation JSON file.

Pointing Create ML to the directory with the images and their associate annotation JSON file it's happily humming away doing training on these classes. In a day or so I can report back how this worked out. :-)

Accepted Answer

For what it's worth, I created a quick and dirty little shell script to create the annotation file expected by Create ML for all my already cropped images. In my case, since the filename for each image has the class identified by the first 4 letters of the filename, my script copies that out to put into the class field for each image file annotation. I just divide the width and height of the image file by two to get the centre point as x and y, again to suite the structure of these annotations.

After running it in one of my directories containing just under 40,000 cropped images, it output a perfectly valid annotation JSON file.

Pointing Create ML to the directory with the images and their associate annotation JSON file it's happily humming away doing training on these classes. In a day or so I can report back how this worked out. :-)

Q: How to used cropped images in Create ML as Object Detection training data without JSON annotation
 
 
Q