Skip to content

Split and merge COCO files

Notifications You must be signed in to change notification settings

ignacy/coco_mingler

Repository files navigation

example workflow

COCO Mingler

COCO “Common Objects In Context” is a file format for storing datasets for computer vision. You can find detailed description here.

COCO files can be really large and this script helps to solve that problem by providing a tool for splitting them into multiple files (one per each image) and also merging them back together.

Usage

  1. To run tests:
python -m tests
  1. To split COCO file into smaller ones:
bin/coco_mingler -i <path> -o <outputdir>

# Example:

bin/coco_mingler -i data/instances_minitrain2017.json -o tmp/images

Files will end up in tmp/images if -o is not specified

  1. To merge files into one COCO file
bin/coco_mingler -m <path_to_directory> -o <outputfile>

# Example:

bin/coco_mingler -m tmp/images -o tmp/merged.json