Tutorial of converting yolo format txt file to xml VOC annotation tool

Some friends often download pictures and yolo format txt files from the Internet. Although they can be used, they can only be used for darknet training, and cannot be used for effiecient or other framework training. General yolo format Txt file format

As shown on the right side of the picture

 

But I want to convert to xml format, like the following format

<annotation>
    <folder>VOC</folder>
    <filename>000000000042.jpg</filename>
    <source>
        <database>My Database</database>
        <annotation>COCO</annotation>
        <image>flickr</image>
        <flickrid>NULL</flickrid>
    </source>
    <owner>
        <flickrid>NULL</flickrid>
        <name>company</name>
    </owner>
    <size>
        <width>640</width>
        <height>478</height>
        <depth>3</depth>
    </size>
    <segmented>0</segmented>
    <object>
        <name>dog</name>
        <pose>Unspecified</pose>
        <truncated>0</truncated>
        <difficult>0</difficult>
        <bndbox>
            <xmin>214</xmin>
            <ymin>41</ymin>
            <xmax>562</xmax>
            <ymax>285</ymax >
        </bndbox>
    </object>
</annotation> Is
this txt to xml format possible? It is completely possible. In order to solve this problem, I developed a small tool that can realize reverse conversion, that is, the yolo format of txt is converted into the format of annotated VOC xml folder. The conversion requirements are:

(1) There must be a picture file

(2) The picture corresponds to the txt file

As long as there are the above two, we don’t have to worry about the conversion problem. The software needs to be authorized and available. If you follow the WeChat public account, the future independent research center can contact us

Steps for usage:

Step 1: Open the software, drag the image folder and txt folder to the corresponding location

Step 2: Click Start Conversion to complete the conversion. After conversion, the corresponding index will be stored in obj.names, such as

0

1

2

If you know the index name, we can also use this software to change the index to the corresponding category name

We change obj.names to the following format

0=dog

1=cat

2=pig

Then import our software to complete the conversion work, isn't it very convenient?

 

Guess you like

Origin blog.csdn.net/FL1623863129/article/details/113484968