class composer.algorithms.SqueezeExcite(latent_channels=64, min_channels=128)[source]#

Adds Squeeze-and-Excitation blocks (Hu et al, 2019) after the torch.nn.Conv2d modules in a neural network.

Runs on Event.INIT. See SqueezeExcite2d for more information.

  • latent_channels (float, optional) โ€“ Dimensionality of the hidden layer within the added MLP. If less than 1, interpreted as a fraction of the number of output channels in the torch.nn.Conv2d immediately preceding each Squeeze-and-Excitation block. Default: 64.

  • min_channels (int, optional) โ€“ An SE block is added after a torch.nn.Conv2d module conv only if min(conv.in_channels, conv.out_channels) >= min_channels. For models that reduce spatial size and increase channel count deeper in the network, this parameter can be used to only add SE blocks deeper in the network. This may be desirable because SE blocks add less overhead when their inputs have smaller spatial size. Default: 128.