LabelImg for Labeling Object Detection Data

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.

Label and Annotate Data with Roboflow for free

Use Roboflow to manage datasets, label data, and convert to 26+ formats for using different models. Roboflow is free up to 10,000 images, cloud-based, and easy for teams.

What is 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 object detection project.

What are LabelImg Labels Used for?

Labels are used to help identify components in your data which you want to train your model to identify in datasets that are not labeled.

High quality datasets are essential for computer vision and building a highly performant model. Creating computer vision models follows the garbage in, garbage out philosophy which means labeling images carefully and accurately is important. We've created a guide to labeling to help make sure your training dataset is high quality.

LabelImg Tutorial

LabelImg does require a little bit of technical awareness (like using the command line) to get going.

LabelImg Download

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.

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

How do I use LabelImg Tools?

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 labeling tutorial

Labeling Best Practices with LabelImg

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. Be sure to read our full deep dive on labeling best practices.

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

Use LabelImg Annotations to train a model in one-click

Use your labeled images to train a model for free using Roboflow Train.

LabelImg Alternatives

While LabelImg has great brand recognition, there are many other computer vision annotation tools.

We're partial to Roboflow Annotate, which is we designed to smooth out the rough edges present in many open source labeling tools. But we also cover many other options in our Ultimate Guide to Object Detection.

Using your LabelImg Labeled Dataset

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