VisualizationHook¶
- class mmocr.engine.hooks.VisualizationHook(enable=False, interval=50, score_thr=0.3, show=False, draw_pred=False, draw_gt=False, wait_time=0.0, backend_args=None)[源代码]¶
Detection Visualization Hook. Used to visualize validation and testing process prediction results.
- 参数
enable (bool) – Whether to enable this hook. Defaults to False.
interval (int) – The interval of visualization. Defaults to 50.
score_thr (float) – The threshold to visualize the bboxes and masks. It’s only useful for text detection. Defaults to 0.3.
show (bool) – Whether to display the drawn image. Defaults to False.
wait_time (float) – The interval of show in seconds. Defaults to 0.
backend_args (dict, optional) – Instantiates the corresponding file backend. It may contain backend key to specify the file backend. If it contains, the file backend corresponding to this value will be used and initialized with the remaining values, otherwise the corresponding file backend will be selected based on the prefix of the file path. Defaults to None.
draw_pred (bool) –
draw_gt (bool) –
- 返回类型
- after_test_iter(runner, batch_idx, data_batch, outputs)[源代码]¶
Run after every testing iterations.
- 参数
runner (
Runner
) – The runner of the testing process.batch_idx (int) – The index of the current batch in the val loop.
data_batch (Sequence[dict]) – Data from dataloader.
outputs (Sequence[Union[mmocr.structures.textdet_data_sample.TextDetDataSample, mmocr.structures.textrecog_data_sample.TextRecogDataSample]]) –
- 返回类型
:param outputs (Sequence[
TextDetDataSample
or:TextRecogDataSample
]): Outputs from model.
- after_val_iter(runner, batch_idx, data_batch, outputs)[源代码]¶
Run after every
self.interval
validation iterations.- 参数
runner (
Runner
) – The runner of the validation process.batch_idx (int) – The index of the current batch in the val loop.
data_batch (Sequence[dict]) – Data from dataloader.
outputs (Sequence[Union[mmocr.structures.textdet_data_sample.TextDetDataSample, mmocr.structures.textrecog_data_sample.TextRecogDataSample]]) –
- 返回类型
:param outputs (Sequence[
TextDetDataSample
or:TextRecogDataSample
]): Outputs from model.