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

Decoder for CRNN.

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

Returns

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

Return type

Tensor

forward_train(feat, out_enc=None, data_samples=None)[source]
Parameters
  • 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.

Returns

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

Return type

Tensor

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