有這么個需求是將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>&