/ML_COCO_extract_specific_classes

extract images and annotations from COCO for specific classes

Primary LanguagePythonMIT LicenseMIT

ML_COCO_extract_specific_classes

Extract images and annotations from COCO for specific classes

Table of contents

Explanation

This code basically extracts images and its annotations from COCO dataset for specific classes/categories. The output is formatted to work with Darknet branch by AlexeyAB. This script helps with steps 4 and 5 in How to train (to detect your custom objects) in AlexeyAB repo

However, with some tweaks you can get the desired for format for your own dataset as I considered making the code as scalable and modular as possible.

Prerequisites

Running the code

change these lines to folder location

COCO_FOLDER    = "/path/to/coco/"
DARKNET_FOLDER = "/path/to/darknet/"

change the list to the desired class names

cat_names = ['car', 'bus', 'truck', 'traffic light' , 'stop sign', 'parking meter']