DBPostprocessor¶
- class mmocr.models.textdet.DBPostprocessor(text_repr_type='poly', rescale_fields=['polygons'], mask_thr=0.3, min_text_score=0.3, min_text_width=5, unclip_ratio=1.5, epsilon_ratio=0.01, max_candidates=3000, **kwargs)[源代码]¶
Decoding predictions of DbNet to instances. This is partially adapted from https://github.com/MhLiao/DB.
- 参数
text_repr_type (str) – The boundary encoding type ‘poly’ or ‘quad’. Defaults to ‘poly’.
rescale_fields (list[str]) – The bbox/polygon field names to be rescaled. If None, no rescaling will be performed. Defaults to [‘polygons’].
mask_thr (float) – The mask threshold value for binarization. Defaults to 0.3.
min_text_score (float) – The threshold value for converting binary map to shrink text regions. Defaults to 0.3.
min_text_width (int) – The minimum width of boundary polygon/box predicted. Defaults to 5.
unclip_ratio (float) – The unclip ratio for text regions dilation. Defaults to 1.5.
epsilon_ratio (float) – The epsilon ratio for approximation accuracy. Defaults to 0.01.
max_candidates (int) – The maximum candidate number. Defaults to 3000.
- 返回类型
- get_text_instances(prob_map, data_sample)[源代码]¶
Get text instance predictions of one image.
- 参数
pred_result (Tensor) – DBNet’s output
prob_map
of shape \((H, W)\).data_sample (TextDetDataSample) – Datasample of an image.
prob_map (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
.- 返回类型