Table of contents
1 Installation and use
1.1 Installation
Win
+ R
Enter cmd
to enter the terminal interface
LabelImg
Installation command:
pip install labelimg
If the domestic pip source is not configured, please see ⇒ \Rightarrow⇒
- Temporary workaround: add the source at the end of the above command, such as
pip install labelimg -i https://pypi.tuna.tsinghua.edu.cn/simple
- Permanent solution: You can refer to 5 of my blog Configuring the python environment on Centos7 to change the pip source (including two methods of windows system and centos system)
1.2 Use
LabelImg
After successful installation
Call command:
labelimg
Then the program pops out and the interface is as follows:
We can also use the following calling command:
labelimg JPEGImages classes.txt
Open the folder LabelImg
while opening the tool , and initialize the classes defined in it (so we don't need to manually enter tags when annotating pictures)JPEGImage
classes.txt
In addition, in order to more conveniently label images, we first need to set the following items in LabelImg
the Tools view
tab:
2 Annotation format
LabelImg
It is an open source data annotation tool that can annotate three formats:
PascalVOC
Label format, save asxml
file
The form is as follows:
<?xml version='1.0' encoding='us-ascii'?>
<annotation>
<folder>hat01</folder>
<filename>000000.jpg</filename>
<path>D:\dataset\hat01\000000.jpg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>947</width>
<height>1421</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>hat</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>60</xmin>
<ymin>66</ymin>
<xmax>910</xmax>
<ymax>1108</ymax>
</bndbox>
</object>
</annotation>
YOLO
Label format, save astxt
file
The form is as follows:
0 0.512143611404435 0.4130893736805067 0.8975712777191129 0.733286418015482
Separated by spaces, respectively represent 类别
(starting from 0), normalized frame x_center
, normalized frame, normalized y_center
frame w
, normalized frameh
- Normalized coordinates are a method of describing object positions and dimensions as relative image sizes, commonly used in object detection and computer vision tasks. Under normalized coordinates, the object position and size become values between 0 and 1 , which is convenient for neural network processing. If these values are passed directly to the neural network, it will be difficult for the model to handle due to the differences in different image sizes and object sizes.
- Therefore , we need to convert these values into normalized coordinates by dividing
x_center
,y_center
, by the width or height of the image , respectively, that is , , ,w
h
width
height
x_center/width
y_center/height
w/width
h/height
CreateML
Label format, save asjson
format
The form is as follows:
[{
"image": "000000.jpg", "annotations": [{
"label": "hat", "coordinates": {
"x": 490.3947368421052, "y": 593.5526315789473, "width": 832.0, "height": 1023.9999999999999}}]}]