Utility functions for COCO json annotation format. The COCO Format is defined here. For COCO Evaluation, please use these instead: Official or my fork.
cocojson
is available on pypi throughpip3 install cocojson
- or if you prefer, clone this repo and it can be installed through
pip3 install -e .
(editable install) orpip3 install .
as well.
- Codes to "Utility Tools" can be found in ./cocojson/tools.
- Codes to "Converters" can be found in ./cocojson/convert.
Please click into each for more details (if applicable). Links works only if you're viewing from the github homepage.
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
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 from COCO JSON.
python3 -m cocojson.run.filter_cat -h
Insert any extra attributes/image meta information associated with the images into the coco json file.
python3 -m cocojson.run.insert_img_meta -h
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 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
Merges multiple datasets
python3 -m cocojson.run.merge -h
Merges multiple datasets
python3 -m cocojson.run.merge_from_file -h
Merges multiple coco jsons.
python3 -m cocojson.run.merge_jsons -h
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/negative images from COCO JSON, aka images without associated annotations.
python3 -m cocojson.run.remove_empty -h
Samples k images from a dataset
python3 -m cocojson.run.sample -h
Samples images from each category for given sample number(s).
python3 -m cocojson.run.sample_by_class -h
Split up a COCO JSON file by images into N sets defined by ratio of total images
python3 -m cocojson.run.split -h
Split up a COCO JSON file by images' meta-information/attributes
python3 -m cocojson.run.split_by_meta -h
Visualise annotations onto images. Best used for sanity check.
python3 -m cocojson.run.viz -h
Convert CVAT Video XML to COCO JSON whilst preserving track information.
python3 -m cocojson.run.cvatvid2coco -h
TODO
Converts CrowdHuman's odgt annotation format to COCO JSON format.
python3 -m cocojson.run.crowdhuman2coco -h
Converts Custom Object Detection Logging format to COCO JSON format.
python3 -m cocojson.run.log2coco -h
TODO