Shortcuts

ASTERDecoder

class mmocr.models.textrecog.ASTERDecoder(in_channels, emb_dims=512, attn_dims=512, hidden_size=512, dictionary=None, max_seq_len=25, module_loss=None, postprocessor=None, init_cfg={'layer': 'Conv2d', 'type': 'Xavier'})[源代码]

Implement attention decoder.

参数
  • in_channels (int) – Number of input channels.

  • emb_dims (int) – Dims of char embedding. Defaults to 512.

  • attn_dims (int) – Dims of attention. Both hidden states and features will be projected to this dims. Defaults to 512.

  • hidden_size (int) – Dims of hidden state for GRU. Defaults to 512.

  • dictionary (dict or Dictionary) – The config for Dictionary or the instance of Dictionary. Defaults to None.

  • max_seq_len (int) – Maximum output sequence length \(T\). Defaults to 25.

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

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

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

forward_test(feat=None, out_enc=None, data_samples=None)[源代码]
参数
  • feat (Tensor) – Feature from backbone. Unused in this decoder.

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

  • data_samples (list[TextRecogDataSample], optional) – Batch of TextRecogDataSample, containing gt_text information. Defaults to None. Unused in this decoder.

返回

The raw logit tensor. Shape \((N, T, C)\) where \(C\) is num_classes.

返回类型

Tensor

forward_train(feat=None, out_enc=None, data_samples=None)[源代码]
参数
  • feat (Tensor) – Feature from backbone. Unused in this decoder.

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

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

返回

The raw logit tensor. Shape \((N, T, C)\) where \(C\) is num_classes.

返回类型

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.