Shortcuts

CRNNDecoder

class mmocr.models.textrecog.CRNNDecoder(in_channels, dictionary, rnn_flag=False, module_loss=None, postprocessor=None, init_cfg={'layer': 'Conv2d', 'type': 'Xavier'}, **kwargs)[源代码]

Decoder for CRNN.

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

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

  • rnn_flag (bool) – Use RNN or CNN as the decoder. Defaults to False.

  • module_loss (dict, optional) – Config to build module_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) – A Tensor of shape \((N, C, 1, W)\).

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

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

返回

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

返回类型

Tensor

forward_train(feat, out_enc=None, data_samples=None)[源代码]
参数
  • feat (Tensor) – A Tensor of shape \((N, C, 1, W)\).

  • 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, W, C)\) where \(C\) is num_classes.

返回类型

Tensor

Read the Docs v: latest
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.