GithubHelp home page GithubHelp logo

voc2darktxt's Introduction

Pascal VOC XML to YOLO Darknet TXT Annotations Converter

YOLO Darknet TXT Annotations Format

<object-class> <x> <y> <width> <height>

Where:

<object-class> - integer number of object from 0 to (classes-1)

<x> <y> <width> <height> - float values relative to width and height of image, it can be equal from (0.0 to 1.0)

For example: <x> = <absolute_x> / <image_width> or <height> = <absolute_height> / <image_height>

Attention: <x> <y> - are center of rectangle (are not top-left corner)

For example for img1.jpg you will be created img1.txt containing:

1 0.716797 0.395833 0.216406 0.147222
0 0.687109 0.379167 0.255469 0.158333
1 0.420312 0.395833 0.140625 0.166667

VOC XML Format

<annotation>
	<folder></folder>
	<filename>000001.jpg</filename>
	<size>
		<width>500</width>
		<height>375</height>
		<depth>3</depth>
	</size>
	<object>
		<name>helmet</name>
		<bndbox>
			<xmin>112</xmin>
			<xmax>135</xmax>
			<ymin>145</ymin>
			<ymax>175</ymax>
		</bndbox>
	</object>
	...
</annotation>

File Arrangement

Initial

.
├── ...
├── dataset             
│   ├── Annotations 
|   |   ├── Folder 1
|   |   |   ├── Sub-Folder 1
|   |   |   |   ├── 000xxx.xml
|   |   |   |   ├── 000xxx.xml
|   |   |   |   └── ...
|   |   |   ├── Sub-Folder 2
|   |   |   └── ...
|   |   ├── Folder 2
│   |   └── ...
│   ├── Images  
│   └── ...
└── ...

Output

.           
├── New-Annotations 
|   ├── Folder 1
|   |   ├── Sub-Folder 1
|   |   |   ├── 000xxx.txt
|   |   |   ├── 000xxx.txt
|   |   |   └── ...
|   |   ├── Sub-Folder 2
|   |   └── ...
|   ├── Folder 2
|   └── ...
└── ...

Requirements

  • Python 3.xx

How to Use?

  • python3 app.py

voc2darktxt's People

Contributors

saksham2001 avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.