Accurately labeled data is essential to successful machine learning, and computer vision is no exception.
In this walkthrough, we’ll demonstrate how you can use LabelImg to get started with labeling your own data for object detection problems.
LabelImg is a free, open source tool for graphically labeling images. It’s written in Python and uses QT for its graphical interface. It’s an easy, free way to label a few hundred images to try out your next project.
LabelImg does require a little bit of technical awareness (like using the command line) to get going.
The easiest way to download and install LabelImg is via pip, and it assumes you’re running Python3. Simply run the following in your command line:
pip3 install labelImg. Then, launch LabelImg by typing
labelImg in your command line prompt.
If you require more specific instructions based on your machine (e.g. Python 2 on Linux, Windows, MacOS Catalina, or using LabelImg with Anaconda), visit the LabelImg README for detailed instruction on installation.
Labeling Images with LabelImg
LabelImg supports labelling in VOC XML or YOLO text file format. At Roboflow, we strongly recommend you use the default VOC XML format for creating labels. Thanks to ImageNet, VOC XML is a more universal standard as it relates to object detection whereas various YOLO implementations have slightly different text file formats. Moreover, you can always easily convert from VOC XML to any other format using Roboflow, like VOC XML to COCO JSON.
Open your desired set of images by selecting “Open Dir” on the left-hand side of LabelImg
To initiate a label, type w, and draw the intended label. Then, type ctrl (or command) S to save the label. Type d to go to the next image (and a to go back an image).
Labeling Best Practices
When labeling images, there are a few tips to bear in mind. Note that these tips are generally true, but can alter based on the context of your problem.
- Label around the entirety of an object. It is best to include a little bit of non-object buffer than it is to exclude a portion of the object with a rectangular label. So, aim to have boxes that tightly mirror the objects you want to label, but do not cut off part of the objects. Your model will understand edges far better this way.
- For occluded objects, label them entirely. If an object is out of view due to another object being in front of it, label the object out of view as if you could see its entirety. Your model will begin to understand the true bounds of objects this way.
- For objects partially out of frame, generally label them. This tip especially depends on your problem, but in general, even a partial object is still an object to be labeled.
- If outsourcing a labeling job, provide crystal clear instructions. If you’re ready to scale up your labeling operations and bring on outside help, be incredibly explicit in your instructions (like mentioning the importance of labeling around an object rather than cutting a portion of the object out of bounds per our first tip!)
Once you have a labeled dataset, you can use Roboflow to understand how many labels you have for each of your classes, convert annotation formats between model frameworks, generate more training data from your already labeled data, and use our model library to get going with deploying your first deep learning model in production. Take a look at our Getting Started Guide for more.
Want to be the first to know about new content like this? Subscribe.
Roboflow accelerates your computer vision workflow through automated annotation quality assurance, universal annotation format conversion (like PASCAL VOC XML to COCO JSON), team sharing and versioning, and exports directly to file format, like TFRecords. It's free for datasets up to 1GB.