Shortcuts

ResNet

class mmocr.models.textrecog.ResNet(in_channels, stem_channels, block_cfgs, arch_layers, arch_channels, strides, out_indices=None, plugins=None, init_cfg=[{'type': 'Xavier', 'layer': 'Conv2d'}, {'type': 'Constant', 'val': 1, 'layer': 'BatchNorm2d'}])[源代码]
参数
  • in_channels (int) – Number of channels of input image tensor.

  • stem_channels (list[int]) – List of channels in each stem layer. E.g., [64, 128] stands for 64 and 128 channels in the first and second stem layers.

  • block_cfgs (dict) – Configs of block

  • arch_layers (list[int]) – List of Block number for each stage.

  • arch_channels (list[int]) – List of channels for each stage.

  • strides (Sequence[int] or Sequence[tuple]) – Strides of the first block of each stage.

  • out_indices (Sequence[int], optional) – Indices of output stages. If not specified, only the last stage will be returned.

  • plugins (dict, optional) – Configs of stage plugins

  • init_cfg (dict or list[dict], optional) – Initialization config dict.

forward(x)[源代码]

Args: x (Tensor): Image tensor of shape \((N, 3, H, W)\).

返回

Feature tensor. It can be a list of feature outputs at specific layers if out_indices is specified.

返回类型

Tensor or list[Tensor]

参数

x (torch.Tensor) –

forward_plugin(x, plugin_name)[源代码]

Forward tensor through plugin.

参数
返回

Output tensor.

返回类型

torch.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.