neodroidvision.data.synthesis.conversion.mnist.json_generation.coco_json_utilities.AnnotationJsonUtils

class neodroidvision.data.synthesis.conversion.mnist.json_generation.coco_json_utilities.AnnotationJsonUtils[source]

Bases: object

Creates an annotation object to describe a COCO dataset

__init__()[source]

Methods

__init__()

create_coco_annotations(image_mask_path, ...)

Takes a pixel-based RGB image mask and creates COCO annotations. Args: image_mask_path: a Path to the image mask image_id: the integer image id category_ids: a dictionary of integer category ids keyed by RGB color (a tuple converted to a string) e.g. {'(255, 0, 0)': {'category': 'owl', 'super_category': 'bird'} } Returns: annotations: a list of COCO annotation dictionaries that can be converted to json. e.g.: { "segmentation": [[101.79,307.32,69.75,281.11,...,100.05,309.66]], "area": 51241.3617, "iscrowd": 0, "image_id": 284725, "bbox": [68.01,134.89,433.41,174.77], "category_id": 6, "id": 165690 }.

create_coco_annotations(image_mask_path, image_id, category_ids)[source]

Takes a pixel-based RGB image mask and creates COCO annotations. Args: image_mask_path: a Path to the image mask image_id: the integer image id category_ids: a dictionary of integer category ids keyed by RGB color (a tuple converted to a string)

e.g. {‘(255, 0, 0)’: {‘category’: ‘owl’, ‘super_category’: ‘bird’} }

Returns: annotations: a list of COCO annotation dictionaries that can be converted to json. e.g.: {

“segmentation”: [[101.79,307.32,69.75,281.11,…,100.05,309.66]], “area”: 51241.3617, “iscrowd”: 0, “image_id”: 284725, “bbox”: [68.01,134.89,433.41,174.77], “category_id”: 6, “id”: 165690

}