optical.converter.utils

__author__: HashTagML license: MIT Created: Sunday, 28th March 2021

Functions

copyfile(src, dest[, filename])

copies a file from one path to another

create_tf_example(df, root)

returns protobuf for a given image

exists(path)

checks for whether a directory or file exists in the specified path

filter_split_category(df[, split, category])

given the label df, filters the dataframe by split and/or label category

find_job_metadata_key(json_data)

finds metadata key for sagemaker manifest format

find_splits(image_dir, annotation_dir, format)

find the splits in the dataset, will ignore splits for which no annotation is found

get_annotation_dir(root)

returns annotation directory given a root directory

get_id_to_class_map(df)

This function return the class_id to class name mapping

get_image_dir(root)

returns image directory given a root directory

ifnone(x, y[, transform, type_safe])

if x is None return y otherwise x after applying transofrmation transform and casting the result back to original type if type_safe

read_coco(coco_json)

read a coco json and returns the images, annotations and categories dict separately

read_xml(xml_folder, img_path)

read xml files in the folder and return list’s of information used to construct master_df

tf_decode_image(root, data, split)

Decodes images and save in images folder under root

write_json(data_dict, filename)

writes json to disk

write_label_map(id_to_class_map, output_dir)

writes label_map used in tf object detection

write_xml(df, image_root[, output_dir])

write xml files in PASCAL VOC format given a label dataframe