Shortcuts

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)[source]

Decoding predictions of DbNet to instances. This is partially adapted from https://github.com/MhLiao/DB.

Parameters
  • 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.

Return type

None

get_text_instances(prob_map, data_sample)[source]

Get text instance predictions of one image.

Parameters
  • pred_result (Tensor) – DBNet’s output prob_map of shape \((H, W)\).

  • data_sample (TextDetDataSample) – Datasample of an image.

  • prob_map (torch.Tensor) –

Returns

A new DataSample with predictions filled in. Polygons and results are saved in TextDetDataSample.pred_instances.polygons. The confidence scores are saved in TextDetDataSample.pred_instances.scores.

Return type

TextDetDataSample

Read the Docs v: dev-1.x
Versions
latest
stable
v1.0.1
v1.0.0
0.x
v0.6.3
v0.6.2
v0.6.1
v0.6.0
v0.5.0
v0.4.1
v0.4.0
v0.3.0
v0.2.1
v0.2.0
v0.1.0
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.