In this chapter, we learn how to use LabelImg.

At the end of “2. Create the Training Data” of our instructions on how to create Image Inferences, we introduced the annotation data creation tool LabelImg. Learn here how to create annotation data using LabelImg. These are the steps:

1. Check your OS version (Windows, Mac, Linux, etc.) and the current python version support in the “Installation” section of the (LabelImg Github Page) and install it according to the description below.

2. Follow the “Steps (YOLO)” section in the “Usage” part of the LabelImg documentation.

(1) Write the name of the class you want to recognize in data/predefined_classes.txt under the folder where LabelImg is installed. (2) Write the same obj.names that you created in step 1 of Create Model. For example, if you want to recognize person, dog, and cat, the contents should be as this:

3. Start LabelImg with the python command as described in “Installation”. For example, in a python3 environment, type the following command in a terminal environment to start it.


4.Click on the “PascalVOC” button in the toolbar on the left of the LabelImg screen to switch the display to “YOLO”. (It is important to switch the setting to YOLO when you start the program.)

5. Click on the “Open Dir” button on the toolbar on the left of the LabelImg screen, and select images, which you created as a folder for storing images, in the working folder on your PC. The first image in the images folder will be displayed in the center of the LabelImg screen.

6. Specify the destination for the annotation data file after the operation. Click the “Change Save Dir” button on the toolbar on the left of the screen, and select the “labels” folder in the working folder on your computer that you created in step 3 of Create Model

7. Press “w” on the keyboard while the screen is displayed to add annotations to the image. Drag the mouse over the image to determine the rectangular area.

8. Once you have determined the rectangular area with the mouse, a screen for selecting the appropriate object from the object names listed in data/predefined_classes.txt will appear. In the following example, cat is selected.

After you have finished determining the annotation rectangle area for all objects in one image, press the “Save” button on the toolbar on the left of the screen. An annotation data file named ~.txt corresponding to the image name will be generated under the “labels” folder specified in step 6 above. At the same time, a file named classes.txt will also be generated under the labels folder.

See this example:

10. After completing the annotation process for all images in the images folder, move the classes.txt file in labels to a working folder on your computer and rename it obj.names.

This is it. That’s how you use LabelImg to annotate your pictures. If you have any questions or concerns, please don’t hesitate to join our slack channel at

Need more help with this?
Join our slack community for help

Was this helpful?

Yes No
You indicated this topic was not helpful to you ...
Could you please leave a comment telling us why? Thank you!
Thanks for your feedback.