mmagic.models.editors.arcface.arcface_modules
¶
Module Contents¶
Classes¶
Flatten Module. |
|
A named tuple describing a ResNet block. |
|
Squeeze-and-Excitation Modules. |
|
Intermediate Resblock of bottleneck. |
|
Intermediate Resblock of bottleneck with SEModule. |
Functions¶
|
l2 normalization. |
|
Get a single block config. |
|
Get block configs of backbone. |
- class mmagic.models.editors.arcface.arcface_modules.Flatten[源代码]¶
Bases:
torch.nn.Module
Flatten Module.
- mmagic.models.editors.arcface.arcface_modules.l2_norm(input, axis=1)[源代码]¶
l2 normalization.
- 参数
input (torch.Tensor) – The input tensor.
axis (int, optional) – Specifies which axis of input to calculate the norm across. Defaults to 1.
- 返回
Tensor after L2 normalization per-instance.
- 返回类型
Tensor
- class mmagic.models.editors.arcface.arcface_modules.Bottleneck[源代码]¶
Bases:
namedtuple
('Block'
, ['in_channel'
,'depth'
,'stride'
])A named tuple describing a ResNet block.
- mmagic.models.editors.arcface.arcface_modules.get_block(in_channel, depth, num_units, stride=2)[源代码]¶
Get a single block config.
- 参数
in_channel (int) – Input channels.
depth (int) – Output channels.
num_units (int) – Number of unit modules.
stride (int, optional) – Conv2d stride. Defaults to 2.
- 返回
A list of unit modules’ config.
- 返回类型
list
- mmagic.models.editors.arcface.arcface_modules.get_blocks(num_layers)[源代码]¶
Get block configs of backbone.
- 参数
num_layers (int) – Number of ConvBlock layers in backbone.
- 引发
ValueError – num_layers must be one of [50, 100, 152].
- 返回
A list of block configs.
- 返回类型
list
- class mmagic.models.editors.arcface.arcface_modules.SEModule(channels, reduction)[源代码]¶
Bases:
torch.nn.Module
Squeeze-and-Excitation Modules.
- 参数
channels (int) – Input channels.
reduction (int) – Intermediate channels reduction ratio.
- class mmagic.models.editors.arcface.arcface_modules.bottleneck_IR(in_channel, depth, stride)[源代码]¶
Bases:
torch.nn.Module
Intermediate Resblock of bottleneck.
- 参数
in_channel (int) – Input channels.
depth (int) – Output channels.
stride (int) – Conv2d stride.