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)[source]¶
Detection Visualization Hook. Used to visualize validation and testing process prediction results.
- Parameters
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) –
- Return type
- after_test_iter(runner, batch_idx, data_batch, outputs)[source]¶
Run after every testing iterations.
- Parameters
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]]) –
- Return type
:param outputs (Sequence[
TextDetDataSample
or:TextRecogDataSample
]): Outputs from model.
- after_val_iter(runner, batch_idx, data_batch, outputs)[source]¶
Run after every
self.interval
validation iterations.- Parameters
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]]) –
- Return type
:param outputs (Sequence[
TextDetDataSample
or:TextRecogDataSample
]): Outputs from model.