Shortcuts

mmagic.models.editors.arcface.arcface_modules

Module Contents

Classes

Flatten

Flatten Module.

Bottleneck

A named tuple describing a ResNet block.

SEModule

Squeeze-and-Excitation Modules.

bottleneck_IR

Intermediate Resblock of bottleneck.

bottleneck_IR_SE

Intermediate Resblock of bottleneck with SEModule.

Functions

l2_norm(input[, axis])

l2 normalization.

get_block(in_channel, depth, num_units[, stride])

Get a single block config.

get_blocks(num_layers)

Get block configs of backbone.

class mmagic.models.editors.arcface.arcface_modules.Flatten[source]

Bases: torch.nn.Module

Flatten Module.

forward(input)[source]
mmagic.models.editors.arcface.arcface_modules.l2_norm(input, axis=1)[source]

l2 normalization.

Parameters
  • input (torch.Tensor) – The input tensor.

  • axis (int, optional) – Specifies which axis of input to calculate the norm across. Defaults to 1.

Returns

Tensor after L2 normalization per-instance.

Return type

Tensor

class mmagic.models.editors.arcface.arcface_modules.Bottleneck[source]

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

Get a single block config.

Parameters
  • in_channel (int) – Input channels.

  • depth (int) – Output channels.

  • num_units (int) – Number of unit modules.

  • stride (int, optional) – Conv2d stride. Defaults to 2.

Returns

A list of unit modules’ config.

Return type

list

mmagic.models.editors.arcface.arcface_modules.get_blocks(num_layers)[source]

Get block configs of backbone.

Parameters

num_layers (int) – Number of ConvBlock layers in backbone.

Raises

ValueErrornum_layers must be one of [50, 100, 152].

Returns

A list of block configs.

Return type

list

class mmagic.models.editors.arcface.arcface_modules.SEModule(channels, reduction)[source]

Bases: torch.nn.Module

Squeeze-and-Excitation Modules.

Parameters
  • channels (int) – Input channels.

  • reduction (int) – Intermediate channels reduction ratio.

forward(x)[source]

Forward Function.

class mmagic.models.editors.arcface.arcface_modules.bottleneck_IR(in_channel, depth, stride)[source]

Bases: torch.nn.Module

Intermediate Resblock of bottleneck.

Parameters
  • in_channel (int) – Input channels.

  • depth (int) – Output channels.

  • stride (int) – Conv2d stride.

forward(x)[source]

Forward function.

class mmagic.models.editors.arcface.arcface_modules.bottleneck_IR_SE(in_channel, depth, stride)[source]

Bases: torch.nn.Module

Intermediate Resblock of bottleneck with SEModule.

Parameters
  • in_channel (int) – Input channels.

  • depth (int) – Output channels.

  • stride (int) – Conv2d stride.

forward(x)[source]

Forward function.

Read the Docs v: latest
Versions
latest
stable
0.x
Downloads
pdf
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.