好久没写博客 找写博客的连接找了好久。。。
还是得记录代码,很多代码用过之后很难找到了就。
下面代码是yolo数据格式转voc数据格式,即txt转xml(copy一位老哥的代码)
import cv2
import os
xml_head = '''<annotation>
<folder>VOC2007</folder>
<!--文件名-->
<filename>{}</filename>.
<source>
<database>The VOC2007 Database</database>
<annotation>PASCAL VOC2007</annotation>
<image>flickr</image>
<flickrid>325991873</flickrid>
</source>
<owner>
<flickrid>null</flickrid>
<name>null</name>
</owner>
<size>
<width>{}</width>
<height>{}</height>
<depth>{}</depth>
</size>
<segmented>0</segmented>
'''
xml_obj = '''