8.1.2.13. blueoil.visualize

Inference results visualization (decoration) functions and helpers.

8.1.2.13.1. Module Contents

8.1.2.13.1.1. Functions

visualize_classification(image, post_processed, config)

Draw classfication result to inference input image.

visualize_object_detection(image, post_processed, config)

Draw object detection result boxes to image.

visualize_semantic_segmentation(image, post_processed, config)

Draw semantic segmentation result mask to image.

visualize_keypoint_detection(image, joints, original_image_size=None)

Draw keypoint detection result joints to image.

label_to_color_image(results, colormap)

Adds color defined by the colormap to the label.

draw_fps(pil_image, fps, fps_only_network)

Draw FPS information to image object.

blueoil.visualize.FONT = DejaVuSans.ttf
blueoil.visualize.visualize_classification(image, post_processed, config)

Draw classfication result to inference input image.

Parameters
Returns

drawn image object.

Return type

PIL.Image.Image

blueoil.visualize.visualize_object_detection(image, post_processed, config)

Draw object detection result boxes to image.

Parameters
Returns

drawn image object.

Return type

PIL.Image.Image

blueoil.visualize.visualize_semantic_segmentation(image, post_processed, config)

Draw semantic segmentation result mask to image.

Parameters
Returns

drawn image object.

Return type

PIL.Image.Image

blueoil.visualize.visualize_keypoint_detection(image, joints, original_image_size=None)

Draw keypoint detection result joints to image.

Parameters
  • image – a numpy array of shape (height, width, 3).

  • joints – a numpy array of shape (num_joints, 3).

  • original_image_size – a tuple, (original_height, original_width). If not None, joints will be scaled.

Returns

a numpy array of shape (height, width, 3).

Return type

drawed_image

blueoil.visualize.label_to_color_image(results, colormap)

Adds color defined by the colormap to the label.

Parameters
  • results – A 2D array with float type, storing the segmentation label.

  • colormap – An ndarray with integer type. The number of classes with

  • colour label. (respective) –

Returns

A 2D array with integer type. The element of the array is the color indexed by the corresponding element in the input label to the CamVid color map.

Raises

ValueError – If label is not of rank 2 or its value is larger than color map maximum entry.

blueoil.visualize.draw_fps(pil_image, fps, fps_only_network)

Draw FPS information to image object.

Parameters
  • pil_image (PIL.Image.Image) – Image object to be draw FPS.

  • fps (float) – Entire inference FPS .

  • fps_only_network (float) – FPS of network only (not pre/post process).

Returns: