我们的项目VOC2007数据集类别不同,所以要制作自己的数据集txt文件
查看XML文件
object标签里面的 name 标签存的是类别名
<object> <name>mandatory sign</name> <pose>Unspecified</pose> <truncated>0</truncated> <difficult>0</difficult> <bndbox> <xmin>288</xmin> <ymin>54</ymin> <xmax>297</xmax> <ymax>64</ymax> </bndbox> </object> <object> <name>Park to give way</name> <pose>Unspecified</pose> <truncated>0</truncated> <difficult>0</difficult> <bndbox> <xmin>289</xmin> <ymin>63</ymin> <xmax>298</xmax> <ymax>73</ymax> </bndbox> </object>
总结好类别
classes_eng = ['Fire Exit. No Parking', 'Pedestrians and non-motor vehicles are prohibited', 'Prohibition of electric bicycles', 'No thoroughfare', 'Prohibition of tricycles and motor vehicles', 'Prohibit tractors from entering!', 'Prohibition of non-motorized vehicles', 'No Entry', 'Ban large passenger vehicles from entering', 'Ban animal-drawn vehicles entering', 'Prohibit motorized vehicles', 'Prohibition of entry of small passenger cars', 'Two-wheeled motorcycles are prohibited', 'Prohibition of human-powered cargo tricycles from entering', 'Prohibit laden car into', 'It is forbidden to tow or trailer vehicles', 'Prohibit certain two types of vehicles from entering', 'Human-powered passenger tricycles are prohibited from entering', 'No rickshaws are allowed', 'Prohibited left turn', 'Prohibited left turn and straight', 'Lifting the prohibition on overtaking', 'Prohibited right turn', 'Prohibited right turn and straight', 'No parking', 'Prohibition straight', 'No U-turn', 'No long-term parking', 'Prohibit pedestrians entering', 'No left or right turn', 'No Overtaking', 'Prohibit honking', 'Limit width', 'Limit speed', 'Slow down and give way', 'Limit height', 'Speed restrictions lifted', 'Give Way to Oncoming Vehicles', 'Limit weight', 'Parking inspection', 'Limit axle load', 'Park to give way', 'Prohibit entry of vehicles transporting dangerous goods', 'customs', 'Long time parking is prohibited in the area', 'Long-term parking prohibited in the area lifted', 'Parking prohibited area', 'Regional no parking lifted', 'Regional speed limit', 'Area speed limit lifted', 'Prohibition of electric tricycles', 'Prohibition of right turning of passenger cars', 'No left turn for trucks', 'Warning signs', 'mandatory sign']
修改voc_classes.txt文件
生成train test txt文件
用voc2yolo4.py文件生成对应的训练集、测试集文件,修改train_precent 训练集测试集比重
执行后得到训练集、测试集的图片名
记得修改自己的文件路径
修改voc_annotation.py文件
更换里面的classes类别列表为交通标志识别类别
执行后,可以得到你的train test val 文件
打开文件,里面存储的是训练集的图片对应的文件路径和标注的交通标志的位置和类别
例如
00025.jpg对应的xml文件标注几个标志就有多少个组(一组包括4个标志的位置坐标和类别标签)
可以看到有3个标志被标注
数据集准备工作完成,后续会介绍train.py文件,然后将整个项目上传到资源中。