Skip to main content

Utility functions for manipulating COCO json annotation format

Project description

cocojson

Utility functions for COCO json annotation format. The COCO Format is defined here.

Install

  • cocojson is available on pypi through pip3 install cocojson
  • or if you prefer, clone this repo and it can be installed through pip3 install -e . (editable install) or pip3 install . as well.

Usage

Please click into each for more details (if applicable). Links works only if you're viewing from the github homepage.

Utility Tools

COCO Categori-fy

Convert your custom dataset into COCO categories. Usually used for testing a coco-pretrained model against a custom dataset with overlapping categories with the 80 COCO classes.

python3 -m cocojson.run.coco_catify -h

Extract only Annotations

Get annotations/predictions only from a COCO JSON. Usually used to generate a list of predictions for COCO evaluation.

python3 -m cocojson.run.pred_only -h

Filter Categories

Filter categories from COCO JSON.

python3 -m cocojson.run.filter_cat -h

Insert Images Meta-Information

Insert any extra attributes/image meta information associated with the images into the coco json file.

python3 -m cocojson.run.insert_img_meta -h

Map Categories

Mapping categories to a new dataset. Usually used for converting annotation labels to actual class label for training.

python3 -m cocojson.run.map_cat -h

Match Images between 2 COCO JSONs

Match images between a reference COCO JSON A and COCO JSON B (to be trimmed). Any images in JSON B that is not found in JSON A will be removed (along with associated annotations)

python3 -m cocojson.run.match_imgs -h

Merge

Merges multiple datasets

python3 -m cocojson.run.merge -h

Merge from file

Merges multiple datasets

python3 -m cocojson.run.merge_from_file -h

Prune Ignores

Remove images annotated with certain "ignore" category labels. This is usually used for removing rubbish images that are pointed out by annotators to ignore frame.

python3 -m cocojson.run.ignore_prune -h

Remove Empty

Remove empty/negative images from COCO JSON, aka images without associated annotations.

python3 -m cocojson.run.remove_empty -h

Sample

Samples k images from a dataset

python3 -m cocojson.run.sample -h

Sample by Category

Samples images from each category for given sample number(s).

python3 -m cocojson.run.sample_by_class -h

Split

Split up a COCO JSON file by images into N sets defined by ratio of total images

python3 -m cocojson.run.split -h

Split by Image Meta-Information

Split up a COCO JSON file by images' meta-information/attributes

python3 -m cocojson.run.split_by_meta -h

Visualise

Visualise annotations onto images. Best used for sanity check.

python3 -m cocojson.run.viz -h

Converters

CVAT Video XML to COCO JSON

Convert CVAT Video XML to COCO JSON whilst preserving track information.

python3 -m cocojson.run.cvatvid2coco -h

CVAT Image XML to COCO JSON

TODO

CrowdHuman odgt to COCO JSON

Converts CrowdHuman's odgt annotation format to COCO JSON format.

python3 -m cocojson.run.crowdhuman2coco -h

Custom Object Detection Logging format to COCO JSON

Converts Custom Object Detection Logging format to COCO JSON format.

python3 -m cocojson.run.log2coco -h

COCO to Darknet

TODO

COCO Eval

Please use https://github.com/levan92/cocoapi.

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

cocojson-0.1.1.tar.gz (24.4 kB view details)

Uploaded Source

Built Distribution

cocojson-0.1.1-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

Details for the file cocojson-0.1.1.tar.gz.

File metadata

  • Download URL: cocojson-0.1.1.tar.gz
  • Upload date:
  • Size: 24.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for cocojson-0.1.1.tar.gz
Algorithm Hash digest
SHA256 a93e15d48a19c427c6afbb3e2dae875487d7468ed714cb9723e68638ecf0d291
MD5 98d935722924555a48ac98ed1a92eeb3
BLAKE2b-256 fa2996dd2541ed9bc2a62dceaade87a1849c7a09616efe3ef53596f3b921776e

See more details on using hashes here.

File details

Details for the file cocojson-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cocojson-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 36.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for cocojson-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1aff848695dc89ec3a7771f7b987e9c7ec224db257df47e84858a9f71d1e175
MD5 0ae14e9d5ade5c379fabcb431f8c8560
BLAKE2b-256 b13fa2051fe6335425da2ef96d94c63ca9a5a4e53527d1ab4ae7478887bc15da

See more details on using hashes here.

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