How to Label Images for Object Detection (Free Guide 2023)
Labeling data for training a robust and production-ready machine learning model is a time-consuming process, but the more dedication you put into it, the more accurate your AI model will be, and the better it will perform in real world situations.
Why Do We Need to Make Labels in Machine Learning?
In traditional programming we have to specify a large number of clearly defined instructions for our program to produce the desired outputs given any set of expected inputs. But this is not the case in object detection, or machine learning in general. The machine has to learn from the data we provide to it.
Instead of us clearly defining every step to take a given input and producing a desired output, in machine learning we have to collect a large number of examples pairs of inputs and outputs, and ask the machine to figure out by itself the optimal mapping between them.
In the particular case of object detection, the input will always be an image or video frame and the output will be a list of bounding boxes. Each bounding box is made of the (x, y) coordinate of the top left corner of the box, its width and height, and class of object it is bounding.
This output is what we call the Labels or Ground Truth of the input image.
Labeling With Theos AI
In Theos AI we provide several tools for free that are essential for object detection labeling, allowing you to create pixel perfect bounding boxes to train the most robust and accurate AI models for your specific use case. You can invite team members to accelerate your labeling speed and with the help of our magical Autolabeler you will be able to label your data 100 times faster than doing it manually.
In addition, once you finished labeling your entire dataset, you will be able train your AI within your browser in just one click. Theos will handle everything for you, from downloading your dataset to training your AI to deploying it to powerful cloud servers so you can use it in your software by making simple HTTP requests to our REST API. It really is that simple.
Now, let’s begin with the instructions of how to correctly label your object detection dataset.
1. Create a New Project
2. Create a New Image Dataset
To create a new dataset click on the + button inside the new dataset card of the modality of your choice. Write a name for your new dataset and click confirm to create it.
3. Drop Images to Upload
To upload images to your dataset, click on the upload tab and drop images or click one of the two buttons to select them. In most cases, 100 images will work just fine for an initial training. You can always come here again later and upload more images to label, in order to increase the performance of your AI.
4. Upload Your Images
Click the start upload button to upload your images to Theos.
5. Wait for Your Images to Finish Uploading
Please, don't close this browser tab until the upload finishes and make sure your computer does not go to sleep if you happen to upload a large number of images.
6. Add a New Class of Object
Go to the bottom of the page and click the new class button to add a new class of object you want your AI to detect.
7. Confirm the New Class
Write the name of the class and pick its color, finally click the confirm button to create it.
8. Finish Adding All the Classes You Need
After adding all the classes you want your AI to detect we can see their label statistics, or what is known as your dataset's class balance.
9. Start Labeling Your Dataset
Click the start labeling button on the top right corner to start teaching your AI what you want it to detect.
10. Select the Class to Label
Click on the class you want to label or press the shortcut number in your keyboard to select it.
11. Create a Label
Place your mouse at one of the corners of the object you want to label. Then click and drag your mouse to create a new bounding box, finally release your mouse when you have encapsulated the object in the tightest possible manner.
12. Fix Your Label
Labels must encapsulate its object in the most tight and precise way possible, meaning no room has to be left between the bounding box and the contours of the object. If you accidentally made the bounding box bigger or smaller than the object, keep the space key pressed to enter into the transform mode (or click the hand icon in the top left corner) and fix your label. If the object is partially occluded by another object, make your best guess and draw the bounding box up until where you think the whole object contour will likely be.
13. Finish Labeling All the Objects in the Image
Perfectly create all the labels you would want your AI to detect in this example image. Make sure no object is kept unlabeled, as this will confuse your AI and it won't perform well in production. This is very important. A single unlabeled object can significantly impact the accuracy of your AI.
14. Submit Your Labels
After you finished labeling the whole image, press the E shortcut key to submit your labels or click the submit button in the bottom left corner. If image happens to don't have any objects in it, press the Q shortcut key to skip it, or click the skip button in the bottom left corner, next to the submit button.
15. Finish Labeling the Whole Dataset
Finish labeling all the images in your dataset. You can inspect your dataset statistics in the bottom of its overview page. You should always strive to have a balanced dataset, meaning that all your classes have roughly the same number of labels. The more labels a class has, the more examples your AI will have to correctly learn from, and if another class has significantly fewer labels, your AI might mislabel it as the class with more labels or don't recognize it at all. But don't worry if the intrinsic distribution of your data does not allow for this. For example, in this use case people will always have twice more eyes than mouthes, noses, and faces.
16. Autolabel More Images 100x Faster
Now you should continue to add more examples to your dataset and retrain your AI to improve its accuracy. After you deployed your AI with Theos, you can use our magical Autolabeler to label new images 100 times faster. Let your AI help you create a better version of itself.