mindspore.dataset.utils.imshow_det_bbox

mindspore.dataset.utils.imshow_det_bbox(image, bboxes, labels, segm=None, class_names=None, score_threshold=0, bbox_color=(0, 255, 0), text_color=(203, 192, 255), mask_color=(128, 0, 128), thickness=2, font_size=0.8, show=True, win_name='win', wait_time=2000, out_file=None)[source]

Draw an image with given bboxes and class labels (with scores).

Parameters
  • image (ndarray) – The image to be displayed, shaped (C, H, W) or (H, W, C), formatted RGB.

  • bboxes (ndarray) – Bounding boxes (with scores), shaped (N, 4) or (N, 5), data should be ordered with (N, x, y, w, h).

  • labels (ndarray) – Labels of bboxes, shaped (N, 1).

  • segm (ndarray) – The segmentation masks of image in M classes, shaped (M, H, W) (Default=None).

  • class_names (list[str], tuple[str], dict) – Names of each class to map label to class name (Default=None, only display label).

  • score_threshold (float) – Minimum score of bboxes to be shown (Default=0).

  • bbox_color (tuple(int)) – Color of bbox lines. The tuple of color should be in BGR order (Default=(0, 255 ,0), means ‘green’).

  • text_color (tuple(int)) – Color of texts. The tuple of color should be in BGR order (Default=(203, 192, 255), means ‘pink’).

  • mask_color (tuple(int)) – Color of mask. The tuple of color should be in BGR order (Default=(128, 0, 128), means ‘purple’).

  • thickness (int) – Thickness of lines (Default=2).

  • font_size (int, float) – Font size of texts (Default=0.8).

  • show (bool) – Whether to show the image (Default=True).

  • win_name (str) – The window name (Default=”win”).

  • wait_time (int) – Value of waitKey param (Default=2000, means display interval is 2000ms).

  • out_file (str, optional) – The filename to write the imagee (Default=None). File extension name is required to indicate the image compression type, e.g. ‘jpg’, ‘png’.

Returns

The image with bboxes drawn on it.

Return type

ndarray