ParallelSARDecoderWithBS¶
- class mmocr.models.textrecog.ParallelSARDecoderWithBS(beam_width=5, num_classes=37, enc_bi_rnn=False, dec_bi_rnn=False, dec_do_rnn=0, dec_gru=False, d_model=512, d_enc=512, d_k=64, pred_dropout=0.0, max_seq_len=40, mask=True, start_idx=0, padding_idx=0, pred_concat=False, init_cfg=None, **kwargs)[source]¶
Parallel Decoder module with beam-search in SAR.
- Parameters
beam_width (int) – Width for beam search.
- forward_test(feat, out_enc, img_metas)[source]¶
- Parameters
feat (Tensor) – Tensor of shape \((N, D_i, H, W)\).
out_enc (Tensor) – Encoder output of shape \((N, D_m, H, W)\).
data_samples (list[TextRecogDataSample], optional) – Batch of TextRecogDataSample, containing valid_ratio information. Defaults to None.
- Returns
Character probabilities. of shape \((N, self.max_seq_len, C)\) where \(C\) is
num_classes
.- Return type
Tensor