Installation and usage of labelImg
Published:
You may know a task called labelling a dataset. This article tells how to use a tool, labelImg, to label the objects of a image.
At first, I thought Photoshop was applied to draw a colored box to label an object. That was really silly thoughts :(. Yesterday I just heared a tool called labelImg which is prevalent in some field such as object detection.
labelImg is a graphical image annotation tool, which is written in Python and uses Qt for its graphical interface.
Annotations are saved as XML files in PASCAL VOC format, the format used by ImageNet.
The installation of labelImg
The installation of labelImg is abosulately a grind.I failed to install on my Mac and it took some efforts to install on Ubuntu.
The official document is here which may be confusing to you.
Next I will introduce how I succeed in installing on Ubuntu.
First, your machine needs to have python and pip. I will not spare redundant words here explaining this step.
Second, type in directly:
pip install labelImg
Commonly, there is no question in the second step and you will get the following message.
Now I tested whether it can work or not.
Oops! It reminded me of not installing Qt. It is not hard to fix. Type in the following instruction.
sudo apt-get install python-qt4
I tested it again.
It still didn’t work. Luckily, it seems to be the similar problem as last time. I still depended on pip and enter
pip install lxml
Now when I typed in
labelImg
There are no bugs and an interface popped up. Bingo!
The usage of labelImg
I highly recommand the official video. The GUI of labelImg is quite user-friendly and you can simply learn it.
The following image shows I mark the knee in an original medical image.
Then let’s take a look at the saved XML file.
vim test.xml
Note that the XML file now includes the object tag and has the exact class name what I annotated before.
Next I will mark thousands of images and do some certain detection task. If all fares well, I’d love to write about my project in the next few articles.