BaseTextDetPostProcessor¶
- class mmocr.models.textdet.BaseTextDetPostProcessor(text_repr_type='poly', rescale_fields=None, train_cfg=None, test_cfg=None)[源代码]¶
Base postprocessor for text detection models.
- 参数
text_repr_type (str) – The boundary encoding type, ‘poly’ or ‘quad’. Defaults to ‘poly’.
rescale_fields (list[str], optional) – The bbox/polygon field names to be rescaled. If None, no rescaling will be performed.
train_cfg (dict, optional) – The parameters to be passed to
self.get_text_instances
in training. Defaults to None.test_cfg (dict, optional) – The parameters to be passed to
self.get_text_instances
in testing. Defaults to None.
- 返回类型
- get_text_instances(pred_results, data_sample, **kwargs)[源代码]¶
Get text instance predictions of one image.
- 参数
pred_result (tuple(Tensor)) – Prediction results of an image.
data_sample (TextDetDataSample) – Datasample of an image.
**kwargs – Other parameters. Configurable via
__init__.train_cfg
and__init__.test_cfg
.pred_results (Union[torch.Tensor, List[torch.Tensor]]) –
- 返回
A new DataSample with predictions filled in. The polygon/bbox results are usually saved in
TextDetDataSample.pred_instances.polygons
orTextDetDataSample.pred_instances.bboxes
. The confidence scores are saved inTextDetDataSample.pred_instances.scores
.- 返回类型
- rescale(results, scale_factor)[源代码]¶
Rescale results in
results.pred_instances
according toscale_factor
, whose keys are defined inself.rescale_fields
. Usually used to rescale bboxes and/or polygons.- 参数
results (TextDetDataSample) – The post-processed prediction results.
- 返回
Prediction results with rescaled results.
- 返回类型