Skip to content

Instantly share code, notes, and snippets.

Convert PascalVOC Annotations to YOLO

This script reads PascalVOC xml files, and converts them to YOLO txt files.

Note: This script was written and tested on Ubuntu. YMMV on other OS's.

Disclaimer: This code is a modified version of Joseph Redmon's voc_label.py

Instructions:

  1. Place the convert_voc_to_yolo.py file into your data folder.
@vdalv
vdalv / crop_classes.md
Created June 23, 2018 21:52
This script reads PascalVOC xml files, and crops the class instances into seperate image files.

Export Class Images from PascalVOC Annotations

This script reads PascalVOC xml files, and crops the class instances into seperate image files.

Note: This script relies on ImageMagick for the crop (convert) functionality. It comes pre-installed on most recent versions of Ubuntu.

Disclaimer: This code is a modified version of Dat Tran's xml_to_csv.py

Example:

Let's say we have this image in our train folder:

Bulk Downloading With The Ability to Specify Individual Filenames

After a few hours of searching, I've finally found a convenient way to download a large amount of files in a bulk/multi-threaded/parallel manner, while still having the ability to specify the saved files' names.

Many thanks to Diego Torres Milano

The input file (dl_data.txt):

bird_4345_543.jpg https://example.com/pictures/5351/image.jpg
bird_4345_544.jpg https://example.com/5352/pictures/image.jpg