Creating annotated data sets with IBM Cloud Annotations
By the end of this tutorial, you will be able to generate datasets with annotated images that can be used in Create ML for building and training object detection machine learning models for Core ML.
To train Image Classification models is quite simple, you just need to have your dataset organized in folders and you are good to go. To train Object Detection models, on the other hand, requires a special file telling Create ML where each of the objects is located in each image of your dataset.
This special file is a JSON file named annotations.json
, and trust me when I say that creating it manually is an herculean task.
Imagine having to write down the coordinates for the position of each object in each image of your dataset?
Luckily there are tools and platforms out there to support you in this task.
One of them is the IBM Cloud Annotations. It offers fast and easy image annotation in the browser and supports training machine learning models in the cloud as well as exporting datasets for Create ML.
It can be used for free, with some limitations, and should provide everything you need to create annotated datasets to train Object Detection models. Let's see how that works.
Before start working in the platform you need to collect and organize the images that will be used to train your model. You will need at least two different sets of images, one to train the model (called sushiguide-detector in this example) and a different one to test the model (called sushiguide-detector-test in this example).
Once you have all the images organized you can start annotating them. Here are the steps you need to follow to get started:
1. After creating an account, the first step is to start a new project.
2. Name the bucket for your dataset. Provide a name that will allow you to easily identify the dataset, like flowers-training and flowers-testing.
3. When prompted about the annotation type that bucket will host, choose Localization.
4. The final step is to upload the images that compose your dataset to the bucket and you are ready to start annotating.
Now you are ready to start creating annotations in your images.
By clicking and dragging over an image you will create boxes over it that will inform where the object you want to detect is located in the image. You can create multiple boxes if the image contains multiple objects to be detected.
After annotating all the objects in the image you must label each of them on the sidebar to the right. Those labels will inform the training algorithm where each object is located in the image. Each label will be a class for the object detection model, so objects that belong to the same class should be identified with the same label.
Once you have finished annotating all your images you just need to export your annotated dataset from the Fil
menu, choosingExport as Create ML
.
The dataset will be downloaded containing all your images and the corresponding annotations.json
file, containing all the metadata Create ML needs to be able to train an Object Detection model.
This tutorial is part of a series of articles derived from the presentation Creating Machine Learning Models with Create ML presented as a one time event at the Swift Heroes 2021 Digital Conference on April 16th, 2021.
Where to go next?
If you are interested into knowing more about Object Detection models you can check other tutorials on:
- Core ML Explained: Apple's Machine Learning Framework
- Create ML Explained: Apple's Toolchain to Build and Train Machine Learning Models
- Creating a Object Detection Machine Learning Model with Create ML
- Using an Object Detection Machine Learning Model in Swift Playgrounds
You want to know more? There is more to see...
Recommended Content provided by Apple:
For a deeper dive on the topic of creating object detection machine learning models, you can watch the videos released by Apple on WWDC:
- WWDC 2018 - Introducing Create ML
- WWDC 2019 - Introduction the Create ML App
- WWDC 2019 - Training Object Detection Models in Create ML
Other Resources:
If you are interested into knowing more about annotating images for creating object detection machine learning models, you can go through these resources:
- To learn about various alternative options to annotate images to train computer vision machine learning models, consider this list of 24 Best Image Annotation Tools for Computer Vision.
- To understand how to use the open source image annotation tool IBM Cloud Annotations for annotating images or even training your models in the cloud, refer to the official IBM Cloud Annotations documentation.
- To understand how to create a robust object detector through a good variation on training data, read about 6 Obstacle to Robust Object Detection.