cpauger.visualize

Functions

visualize_bboxes(→ None)

Visualize bbox(es) of objects in image(s) when given coco annotation file

random_color(→ Tuple[int, int, int])

Generate random RGB color values

draw_bbox_and_polygons(→ None)

Visualize the bbox(es) and segmentation mask(s) of objects in image(s)

Module Contents

cpauger.visualize.visualize_bboxes(annotation_file: str, image_dir: str, output_dir: str) None[source]

Visualize bbox(es) of objects in image(s) when given coco annotation file

Parameters:
  • annotation_file (str, Path) – Coco annotation file path

  • image_dir (str) – Directory where images to visualize are located

  • output_dir (str) – Directory to store the output of visualization

Returns: None

cpauger.visualize.random_color() Tuple[int, int, int][source]

Generate random RGB color values

cpauger.visualize.draw_bbox_and_polygons(annotation_path: str, img_dir: str | None = None, visualize_dir: str = 'visualize_bbox_and_polygons', imgpaths_list: str | None = None) None[source]

Visualize the bbox(es) and segmentation mask(s) of objects in image(s)

Parameters:
  • annotation_path (str) – Coco annotation path for image(s).

  • img_dir (str, optional) – Directory of images. This is required when imgpaths_list is not provided in which case all images in img_dir will be visualize.

  • visualize_dir (str, optional) – Directory to store output of visualization. Defaults to “visualize_bbox_and_polygons”.

  • imgpaths_list (str, optional) – List of images to visualize. Required when img_dir is not povided. Use when only a subset of images are to visualize rather than all images in the img_dir. Defaults to None.

Returns: None