Shortcuts

SELayer

class mmcls.models.utils.SELayer(channels, squeeze_channels=None, ratio=16, divisor=8, bias='auto', conv_cfg=None, act_cfg=({'type': 'ReLU'}, {'type': 'Sigmoid'}), return_weight=False, init_cfg=None)[source]

Squeeze-and-Excitation Module.

Parameters
  • channels (int) – The input (and output) channels of the SE layer.

  • squeeze_channels (None or int) – The intermediate channel number of SElayer. Default: None, means the value of squeeze_channels is make_divisible(channels // ratio, divisor).

  • ratio (int) – Squeeze ratio in SELayer, the intermediate channel will be make_divisible(channels // ratio, divisor). Only used when squeeze_channels is None. Default: 16.

  • divisor (int) – The divisor to true divide the channel number. Only used when squeeze_channels is None. Default: 8.

  • conv_cfg (None or dict) – Config dict for convolution layer. Default: None, which means using conv2d.

  • return_weight (bool) – Whether to return the weight. Default: False.

  • act_cfg (dict or Sequence[dict]) – Config dict for activation layer. If act_cfg is a dict, two activation layers will be configurated by this dict. If act_cfg is a sequence of dicts, the first activation layer will be configurated by the first dict and the second activation layer will be configurated by the second dict. Default: (dict(type=’ReLU’), dict(type=’Sigmoid’))

forward(x)[source]

Defines the computation performed at every call.

Should be overridden by all subclasses.

Note

Although the recipe for forward pass needs to be defined within this function, one should call the Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.

Read the Docs v: latest
Versions
master
latest
1.x
dev-1.x
Downloads
html
epub
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.