转载:https://www.cnblogs.com/marsggbo/p/11152462.html
VOC下的一个标注:
[menglingxuan@BJ-IDC1-10-10-15-115 Annotations]$ cat 001004.xml
<annotation>
<folder>VOC2007</folder>
<filename>001004.jpg</filename>
<source>
<database>The VOC2007 Database</database>
<annotation>PASCAL VOC2007</annotation>
<image>flickr</image>
<flickrid>331357345</flickrid>
</source>
<owner>
<flickrid>marksontok</flickrid>
<name>Mark</name>
</owner>
<size>
<width>500</width>
<height>375</height>
<depth>3</depth>
</size>
<segmented>0</segmented>
<object>
<name>bird</name>
<pose>Unspecified</pose>
<truncated>0</truncated>
<difficult>0</difficult>
<bndbox>
<xmin>143</xmin>
<ymin>152</ymin>
<xmax>235</xmax>
<ymax>197</ymax>
</bndbox>
</object>
</annotation>
对应的coco格式:
{"images": [{"file_name": "001004.jpg", "height": 375, "width": 500, "id": 1004}], "type": "instances", "annotations": [{"area": 4278, "iscrowd": 0, "image_id": 1004, "bbox": [142, 151, 93, 46], "category_id": 0, "id": 1, "ignore": 0, "segmentation": [[142, 151, 142, 197, 235, 197, 235, 151]]}], "categories": [{"supercategory": "none", "id": 0, "name": "bird"}]}