项目作者: Isabek

项目描述 :
ImageNet file xml format to Darknet text format
高级语言: Python
项目地址: git://github.com/Isabek/XmlToTxt.git
创建时间: 2017-09-13T12:29:51Z
项目社区:https://github.com/Isabek/XmlToTxt

开源协议:

下载


XmlToTxt

ImageNet file xml format to Darknet text format.
Works well with directories and subdirectories.

Installation

  1. sudo pip install -r requirements.txt

Usage

  1. python xmltotxt.py -c cls.txt -xml xml -out out

Mandatory arguments

  1. -xml

Optional arguments

  1. -c, -out

Example

Input xml file.

  1. <annotation>
  2. <filename>image-0000016.jpg</filename>
  3. <size>
  4. <width>1920</width>
  5. <height>1080</height>
  6. </size>
  7. <object>
  8. <name>sedan</name>
  9. <bndbox>
  10. <xmin>75</xmin>
  11. <ymin>190</ymin>
  12. <xmax>125</xmax>
  13. <ymax>210</ymax>
  14. </bndbox>
  15. </object>
  16. </annotation>

Output text file.

  1. 5 0.052083 0.185185 0.026042 0.018519

Motivation

I used Darknet for real-time object detection and classification. Sometimes you need to collect your own training dataset for train your model. I collected training dataset images and fine awesome tool for labeling images. But it generates xml files. So I needed to implement tool which translates from ImageNet xml format to Darknet text format.
Also compatible with latest YOLOv5 by Ultralytics.