Skip to main content

Python package which aims to merge 2 COCO .json files

Project description

Merge .json COCO files

This package is intended for data scientist who wants to merge several COCO datasets before training a new model.

Requirements

python==3.x

Installation

Simply set up a Python environment and type :

pip install COCO_merger

COCO Files Merge Usage

python -m COCO_merger.merge --src Json1.json Json2.json --out OUTPUT_JSON.json

Argument parser

usage: merge.py [-h] --src SRC SRC --out OUT

Merge two annotation files to one file

optional arguments:
  -h, --help     show this help message and exit
  --src SRC SRC  Path of two annotation files to merge
  --out OUT      Path of the output annotation file

Note:

The script will do the following checks as well:

  1. Duplicate filenames checks (to count if the same image has two annotations)
  2. Categories checks (Both files should have same categegories (name, id))

The reason I didn't mix categories, incase they are different, is to help annotators identifying any change in there categories. I believe this will be helpful incase of annotating a dataset as batches or splitting the annotation on members. Any change in ids caused by software being used or human mistake will be directly identified.

Example of Dog category existing in file 2 but not file 1

AssertionError: Category name: Dog in file 2 does not exist in file 1

Example of Cat category existing in both files but with different ids:

AssertionError: Category name: Cat, id: 1 in file 1 and 2 in file 2


Note: the script will do the necessary checks as well (duplicate filenames, ....)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

COCO_merger-0.0.2.tar.gz (5.5 kB view details)

Uploaded Source

File details

Details for the file COCO_merger-0.0.2.tar.gz.

File metadata

  • Download URL: COCO_merger-0.0.2.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for COCO_merger-0.0.2.tar.gz
Algorithm Hash digest
SHA256 176cfbac3d272d64c84d5e139a32e94ef0279f93e1c00e28adadd6e865f03583
MD5 4c0a6683ef8adfdcf793551fe8ae6e4f
BLAKE2b-256 c8d2ea3c4b8f0d104325163b9af03025a8a3893cc3165f89c8891de95ce1539f

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page