Shortcuts

TextRecogLocalVisualizer

class mmocr.visualization.TextRecogLocalVisualizer(name='visualizer', image=None, vis_backends=None, save_dir=None, gt_color='g', pred_color='r', **kwargs)[源代码]

MMOCR Text Detection Local Visualizer.

参数
  • name (str) – Name of the instance. Defaults to ‘visualizer’.

  • image (np.ndarray, optional) – The origin image to draw. The format should be RGB. Defaults to None.

  • vis_backends (list, optional) – Visual backend config list. Defaults to None.

  • save_dir (str, optional) – Save file dir for all storage backends. If it is None, the backend storage will not save any data.

  • gt_color (str or tuple[int, int, int]) – Colors of GT text. The tuple of color should be in RGB order. Or using an abbreviation of color, such as ‘g’ for ‘green’. Defaults to ‘g’.

  • pred_color (str or tuple[int, int, int]) – Colors of Predicted text. The tuple of color should be in RGB order. Or using an abbreviation of color, such as ‘r’ for ‘red’. Defaults to ‘r’.

返回类型

None

add_datasample(name, image, data_sample=None, draw_gt=True, draw_pred=True, show=False, wait_time=0, pred_score_thr=None, out_file=None, step=0)[源代码]

Visualize datasample and save to all backends.

  • If GT and prediction are plotted at the same time, they are

displayed in a stitched image where the left image is the ground truth and the right image is the prediction. - If show is True, all storage backends are ignored, and the images will be displayed in a local window. - If out_file is specified, the drawn image will be saved to out_file. This is usually used when the display is not available.

参数
  • name (str) – The image title. Defaults to ‘image’.

  • image (np.ndarray) – The image to draw.

  • data_sample (TextRecogDataSample, optional) – TextRecogDataSample which contains gt and prediction. Defaults to None.

  • draw_gt (bool) – Whether to draw GT TextRecogDataSample. Defaults to True.

  • draw_pred (bool) – Whether to draw Predicted TextRecogDataSample. Defaults to True.

  • show (bool) – Whether to display the drawn image. Defaults to False.

  • wait_time (float) – The interval of show (s). Defaults to 0.

  • out_file (str) – Path to output file. Defaults to None.

  • step (int) – Global step value to record. Defaults to 0.

  • pred_score_thr (float) – Threshold of prediction score. It’s not used in this function. Defaults to None.

返回类型

None

Read the Docs v: dev-1.x
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.