CharMetric¶
- class mmocr.evaluation.metrics.CharMetric(valid_symbol='[^A-Z^a-z^0-9^一-龥]', collect_device='cpu', prefix=None)[源代码]¶
Character metrics for text recognition task.
- 参数
valid_symbol (str) – Valid characters. Defaults to ‘[^A-Z^a-z^0-9^一-龥]’
collect_device (str) – Device name used for collecting results from different ranks during distributed training. Must be ‘cpu’ or ‘gpu’. Defaults to ‘cpu’.
prefix (str, optional) – The prefix that will be added in the metric names to disambiguate homonymous metrics of different evaluators. If prefix is not provided in the argument, self.default_prefix will be used instead. Defaults to None.
- 返回类型
- compute_metrics(results)[源代码]¶
Compute the metrics from processed results.
- 参数
results (list[Dict]) – The processed results of each batch.
- 返回
The computed metrics. The keys are the names of the metrics, and the values are corresponding results.
- 返回类型
Dict
- process(data_batch, data_samples)[源代码]¶
Process one batch of data_samples. The processed results should be stored in
self.results
, which will be used to compute the metrics when all batches have been processed.- 参数
data_batch (Sequence[Dict]) – A batch of gts.
data_samples (Sequence[Dict]) – A batch of outputs from the model.
- 返回类型