一、安装
1.下载官方源码
https://github.com/cgvict/roLabelImg
2.配置所需环境
# 安装qt5
pip install pyqt5
# 安装lxl
pip install lxml
3.pycharm进入源码,现在设置中进入配好的环境,打开Terminal
pyrcc5 -o resources.py resources.qrc
注意安装的qt5,所以pyrcc5,如果安装的qt4,要改成pyrcc4
python roLabelImg.py
必须修改roLabelImg.py开头的编码格式!!!要不会报错:
NameError: name 'codecs' is not defined
修改后的roLabelImg.py开头:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
正常启动界面,没有报错。
进入界面
二、使用
1.将要标注的数据集存放在data文件夹下。可以不放在这里前提你要能找到。
2.由于是旋转框标注,而且是由labelme改进的,故自然支持水平框标注。
3.导入图片文件夹位置
4.界面如下
5.进行标注
左键点角点改变宽高,右键点角点改变角度
6.保存看看生成的xml文件内容
<annotation verified="no">
<folder>img</folder>
<filename>1</filename>
<path>D:\Project\roLabelImg-master\roLabelImg-master\data\img\1.jpg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>1240</width>
<height>698</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<type>robndbox</type>
<name>make</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<robndbox>
<cx>493.904</cx>
<cy>506.6965</cy>
<w>483.5516</w>
<h>164.3182</h>
<angle>0.518269</angle>
</robndbox>
</object>
</annotation>
7.看看角度定义,注意看角度部分,发现经过顺时针旋转小角度(下),和逆时针旋转大角度(上),在xml文件下角度一样,说明了角度取值范围为0到pi(弧度制)。
此图对应xml文件
<annotation verified="no">
<folder>img</folder>
<filename>1</filename>
<path>D:\Project\roLabelImg-master\roLabelImg-master\data\img\1.jpg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>1240</width>
<height>698</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<type>robndbox</type>
<name>ren</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<robndbox>
<cx>500.129</cx>
<cy>494.6632</cy>
<w>537.0</w>
<h>180.0</h>
<angle>0.472498</angle>
</robndbox>
</object>
<object>
<type>robndbox</type>
<name>ren</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<robndbox>
<cx>593.629</cx>
<cy>298.5968</cy>
<w>534.0</w>
<h>147.0</h>
<angle>0.479751</angle>
</robndbox>
</object>
</annotation>