PANPostprocessor¶
- class mmocr.models.textdet.PANPostprocessor(text_repr_type='poly', score_threshold=0.3, rescale_fields=['polygons'], min_text_confidence=0.5, min_kernel_confidence=0.5, distance_threshold=3.0, min_text_area=16, downsample_ratio=0.25)[源代码]¶
Convert scores to quadrangles via post processing in PANet. This is partially adapted from https://github.com/WenmuZhou/PAN.pytorch.
- 参数
text_repr_type (str) – The boundary encoding type ‘poly’ or ‘quad’. Defaults to ‘poly’.
score_threshold (float) – The minimal text score. Defaults to 0.3.
rescale_fields (list[str]) – The bbox/polygon field names to be rescaled. If None, no rescaling will be performed. Defaults to [‘polygons’].
min_text_confidence (float) – The minimal text confidence. Defaults to 0.5.
min_kernel_confidence (float) – The minimal kernel confidence. Defaults to 0.5.
distance_threshold (float) – The minimal distance between the point to mean of text kernel. Defaults to 3.0.
min_text_area (int) – The minimal text instance region area. Defaults to 16.
downsample_ratio (float) – Downsample ratio. Defaults to 0.25.
- 返回类型
- get_text_instances(pred_results, data_sample, **kwargs)[源代码]¶
Get text instance predictions of one image.
- 参数
pred_result (torch.Tensor) – Prediction results of an image which is a tensor of shape \((N, H, W)\).
data_sample (TextDetDataSample) – Datasample of an image.
pred_results (torch.Tensor) –
- 返回
A new DataSample with predictions filled in. Polygons and results are saved in
TextDetDataSample.pred_instances.polygons
. The confidence scores are saved inTextDetDataSample.pred_instances.scores
.- 返回类型