1.前言
大家常用labelimg标注物体,但当目标物体是倾斜角度时,labelimg标注时会把不属于物体的一大片区域也标注,这样标注效果不大好,那么有什么工具可以标注倾斜的矩形框呢,本篇通过介绍安装rolabelimg或者labelimg2(这两个除了UI界面不同,操作起来都一样),来解决该问题。
安装
2.安装
1.安装labelimg
要装rolabelimg要先装labelimg
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple labelImg==1.8.3
2.安装rolabelimg或者labelimg2
去github下载项目
rolabelimg
https://github.com/cgvict/roLabelImg
labelimg2
https://github.com/chinakook/labelImg2
3.运行
解压后,进入项目中运行一下命令即可驱动
labelimg2的界面
python labelImg.py
rolabelimg的界面
python roLabelImg.py
报错注意:
运行roLabelImg.py,遇到报错:name ‘codecs’ is not defined时,只需将roLabelImg.py文件中的头部的
# -- coding: utf8 --
改成
改成# -- coding: utf-8 --
4.操作快捷键
5.数据格式
labelimg2的格式
<annotation verified="yes">
<folder>images</folder>
<filename>fire_000003.jpg</filename>
<path>H:\fire_img\fire_smoke\images\fire_000003.jpg</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>490</width>
<height>367</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>dog</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>329</xmin>
<ymin>103</ymin>
<xmax>389</xmax>
<ymax>179</ymax>
</bndbox>
<extra/>
</object>
<object>
<name>dog</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<robndbox>
<cx>278.1473</cx>
<cy>157.4751</cy>
<w>37.0</w>
<h>40.0</h>
<angle>1.237309</angle>
</robndbox>
<extra/>
</object>
</annotation>
roLabelImg的格式
<annotation verified="yes">
<folder>hsrc</folder>
<filename>100000001</filename>
<path>/Users/haoyou/Library/Mobile Documents/com~apple~CloudDocs/OneDrive/hsrc/100000001.bmp</path>
<source>
<database>Unknown</database>
</source>
<size>
<width>1166</width>
<height>753</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<type>bndbox</type>
<name>ship</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>178</xmin>
<ymin>246</ymin>
<xmax>974</xmax>
<ymax>504</ymax>
</bndbox>
</object>
<object>
<type>robndbox</type>
<name>ship</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<robndbox>
<cx>580.7887</cx>
<cy>343.2913</cy>
<w>775.0449</w>
<h>170.2159</h>
<angle>2.889813</angle>
</robndbox>
</object>
</annotation>
roLabelImg比labelimg2的数据也就多了一个参数。
经过测试,rolabelimg无法导入labelimg2和labelimg标注数据。
而labelimg2则可以正常导入其它2种标注工具的标注过的数据。