Shortcuts

TextRecogLocalVisualizer

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

MMOCR Text Detection Local Visualizer.

Parameters
  • 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’.

Return type

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)[source]

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.

Parameters
  • 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.

Return type

None

Read the Docs v: dev-1.x
Versions
latest
stable
v1.0.1
v1.0.0
0.x
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.1
v0.2.0
v0.1.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.