

Currently does not change any hierarchy information _categories - Remove categories and all annotations in those categories. _annotations - Remove multiple annotations from the dataset. _annotation_keypoints - Removes all keypoints with a particular category _annotation - Remove a single annotation from the dataset _image - Like add_image(), but returns the existing image id if it already exists instead of failing. _category - Like add_category(), but returns the existing category id if it already exists instead of failing. _images - Removes all images and annotations (but not categories) _annotations - Removes all annotations (but not images and categories) _video - Add a video to the dataset (dynamically updates the index) _images - Faster less-safe multi-item alternative _image - Add an image to the dataset (dynamically updates the index) _annotations - Faster less-safe multi-item alternative to add_annotation. _annotation - Add an annotation to the dataset (dynamically updates the index) CocoDataset classmethods (via MixinCocoExtras) ¶ See the in-code documentation for further details. The following is a logical grouping of the public kwcoco.CocoDataset API attributes and methods. show_image ( gid = 1 ) > # Access single-item data via imgs, cats, anns > cid = 1 > self. category_annotation_frequency ())) > # Inspect data > # xdoctest: +REQUIRES(module:kwplot) > import kwplot > kwplot. boxsize_stats (), nl = 3 )) > print ( ub. extended_stats (), nl = 2 )) > print ( ub. remove_categories () > # Look at data > import ubelt as ub > print ( ub. add_annotation ( image_id = gid, category_id = cid, bbox = ) > # Remove data > self. add_image ( 'new-img.jpg' ) > aid = self. CocoDataset ( 'demo.json' ) > # Add data > cid = self. write ( text ) > # Read from disk > self = kwcoco. dataset ) > with open ( 'demo.json', 'w' ) as file : > file. reroot ( absolute = True ) > # could also use demo.dump / demo.dumps, but this is more explicit > text = json. demo () > # Reroot can switch between absolute / relative-paths > demo. > import kwcoco > import json > # Create demo data > demo = kwcoco. Python, this data structure is reasonably efficient. Segmentation formats than the original COCO format. The kwcoco.CocoDataset class is capable of dynamic addition and removal We support helperįunctions that add and remove images, categories, and annotations.

Processes, which optionally show progress by default). Turned off, functions are silent by default (with the exception of long running

It uses the same efficient core indexingĭata structures, but in our implementation the indexing can be optionally The main data structure in this model is largely based on the implementation in Generally a kwcocoįile will live in a “bundle” directory along with the data that it references,Īnd paths in the kwcoco file will be relative to the location of the kwcoco Take one dataset parameter: the path to the kwcoco file. When applying an algorithm to a dataset, it is sufficient to have the algorithm Represents a generic sequence of images).Ī kwcoco file is a “manifest” that serves as a single reference that points toĪll images, categories, and annotations in a computer vision dataset. Keypoints, annotation tracks, multi-spectral images, and videos (which Have improved implementations in several places, including segmentations, We are backwards compatible with the original module, but we also Originally developed for the “collected images in context” object detectionĬhallenge. The Kitware COCO module defines a variant of the Microsoft COCO format, Please also see information in the repo README, whichĬontains similar but complementary information.įor notes about warping and spaces see warping_and_spaces. If you are new, please see our getting started document: getting_started
