Shortcuts

ABIEncoder

class mmocr.models.textrecog.ABIEncoder(n_layers=2, n_head=8, d_model=512, d_inner=2048, dropout=0.1, max_len=256, init_cfg=None)[源代码]

Implement transformer encoder for text recognition, modified from <https://github.com/FangShancheng/ABINet>.

参数
  • n_layers (int) – Number of attention layers. Defaults to 2.

  • n_head (int) – Number of parallel attention heads. Defaults to 8.

  • d_model (int) – Dimension \(D_m\) of the input from previous model. Defaults to 512.

  • d_inner (int) – Hidden dimension of feedforward layers. Defaults to 2048.

  • dropout (float) – Dropout rate. Defaults to 0.1.

  • max_len (int) – Maximum output sequence length \(T\). Defaults to 8 * 32.

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

forward(feature, data_samples)[源代码]
参数
  • feature (Tensor) – Feature tensor of shape \((N, D_m, H, W)\).

  • data_samples (List[TextRecogDataSample]) – List of data samples.

返回

Features of shape \((N, D_m, H, W)\).

返回类型

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.