cuvis_ai.utils.numpy

Functions

binary_mask_to_rle(binary_mask)

converts a binary mask to RLE shamelessly copied from https://stackoverflow.com/a/76990451 :param binary_mask: :return:

check_array_shape(array, wanted_shape)

flatten_batch_and_labels(array)

flatten_batch_and_spatial(array)

flatten_labels(array)

flatten_spatial(array)

gen_coco_labels(mask, label_names, ...[, ...])

generating coco labels from numpy image and mask, occluded objects can not be labeled correctly at the moment :param mask: mask should be a mask containing zeros for background and integers for labels :param label_names: list of labels :param output_dir: path where to save the json file, if the output file already exists, the generated labels will be appended :param name: name of the json file :param img: image for which these labels apply :param single_object_per_label: clarify if every object has its own label or if multiple objects share the same label.

get_shape_without_batch(array[, ignore])

unflatten_batch_and_labels(array, orig_shape)

unflatten_batch_and_spatial(array, orig_shape)

unflatten_labels(array, orig_shape)

unflatten_spatial(array, orig_shape)