Shortcuts

RobustScannerFuser

class mmocr.models.textrecog.RobustScannerFuser(dictionary, module_loss=None, postprocessor=None, hybrid_decoder={'type': 'SequenceAttentionDecoder'}, position_decoder={'type': 'PositionAttentionDecoder'}, max_seq_len=30, in_channels=[512, 512], dim=- 1, init_cfg=None)[源代码]

Decoder for RobustScanner.

参数
  • dictionary (dict or Dictionary) – The config for Dictionary or the instance of Dictionary.

  • module_loss (dict, optional) – Config to build module_loss. Defaults to None.

  • postprocessor (dict, optional) – Config to build postprocessor. Defaults to None.

  • hybrid_decoder (dict) – Config to build hybrid_decoder. Defaults to dict(type=’SequenceAttentionDecoder’).

  • position_decoder (dict) – Config to build position_decoder. Defaults to dict(type=’PositionAttentionDecoder’).

  • fuser (dict) – Config to build fuser. Defaults to dict(type=’RobustScannerFuser’).

  • max_seq_len (int) – Maximum sequence length. The sequence is usually generated from decoder. Defaults to 30.

  • in_channels (list[int]) – List of input channels. Defaults to [512, 512].

  • dim (int) – The dimension on which to split the input. Defaults to -1.

  • init_cfg (dict or list[dict], optional) – Initialization configs. Defaults to None.

返回类型

None

forward_test(feat=None, out_enc=None, data_samples=None)[源代码]

Forward for testing.

参数
  • feat (torch.Tensor, optional) – The feature map from backbone of shape \((N, E, H, W)\). Defaults to None.

  • out_enc (torch.Tensor, optional) – Encoder output. Defaults to None.

  • data_samples (Sequence[TextRecogDataSample]) – Batch of TextRecogDataSample, containing vaild_ratio information. Defaults to None.

返回

Character probabilities. of shape \((N, self.max_seq_len, C)\) where \(C\) is num_classes.

返回类型

Tensor

forward_train(feat=None, out_enc=None, data_samples=None)[源代码]

Forward for training.

参数
  • feat (torch.Tensor, optional) – The feature map from backbone of shape \((N, E, H, W)\). Defaults to None.

  • out_enc (torch.Tensor, optional) – Encoder output. Defaults to None.

  • data_samples (Sequence[TextRecogDataSample]) – Batch of TextRecogDataSample, containing gt_text information. Defaults to None.

返回类型

torch.Tensor

Read the Docs v: stable
Versions
latest
stable
0.x
dev-1.x
Downloads
pdf
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.