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 models.

Looking to Use LabelImg Annotations with your model?

Use Roboflow to convert them to whatever format you need.

About LabelImg

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.

Installing LabelImg

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).

LabelImg screenshot: labeling chess pieces for object detection.

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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!) Note: if you're ready to scale past labeling your own images, Roboflow can help! Get in touch regarding our outsourced labeling service.

What’s Next

Once you have a labeled dataset, you can use Roboflow's health check to understand how many labels you have for each of your classes, convert annotation formats between computer vision 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.