有这么个需求是将xml的内容:
1,filename
2.label
3.bndbox:xmin,xmax,ymin,ymax。
…
将这些东西写入excel表格中,方便我统计标签数量和框的分布!
于是撰写了脚本:xml2csv.py
我的xml文件形式如下。大家的目标检测格式大同小异!
<annotation>
<folder>UAV_data</folder>
<filename>0_6326681_136.jpg</filename>
<source>
<database>The UAV autolanding</database>
<annotation>UAV AutoLanding</annotation>
<image>flickr</image>
<flickrid>NULL</flickrid>
</source>
<owner>
<flickrid>NULL</flickrid>
<name>ChaojieZhu</name>
</owner>
<size>
<width>512</width>
<height>512</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>dog</name>
<pose>Unspecified</pose>
<truncated>1</truncated>
&