Foundations to Frontier
Tests
E. Deep Learning › E8 CNN Architectures (one page each)

SENet

SENet (Hu, Shen and Sun, 2018) added squeeze-and-excitation blocks (E7-10) to existing architectures, rescaling each residual branch's channels by gates computed from global context. SE-ResNet-50 cut ResNet-50's top-1 error from 24.8% to 23.3% for 0.26% more compute, and an SE-ResNeXt ensemble won the last ImageNet classification challenge (ILSVRC 2017) with 2.25% top-5 error. This page covers where SE goes in a network, its cost by stage and reduction ratio, and how to trim it. In the exercises you add SE to a residual branch, then compute its overhead across ResNet-50 and reproduce the paper's parameter counts for every reduction ratio: 10% more parameters but only 0.3% more compute, with 62% of the extra parameters in the last stage.

Level 0: Foundation

★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.

Add a volume knob to every block

SENet takes a good network, such as ResNet, and adds a small squeeze-and-excitation unit to every block. Each unit looks at the whole picture, decides which of the block’s channels matter for this image, and turns them up or down before the block’s result is added back. It costs almost no extra computation and made every network it was added to more accurate. A network built this way won the final ImageNet competition in 2017.

Architecture explorer: shapes, parameters and compute
stageoutput C × H × Wparametersmultiply–adds
stem64 × 56 × 56
9.5 k
118.01 M
stage2256 × 56 × 56
241.2 k
667.97 M
stage3512 × 28 × 28
1.35 M
1.03 G
stage41024 × 14 × 14
7.89 M
1.47 G
stage52048 × 7 × 7
16.54 M
810.81 M
head1000 × 1 × 1
2.05 M
2.05 M
Total: 28,088,024 parameters (28.09 M), 4.09 G multiply–adds per image at 224 × 224.
ResNet-5025.56 M parameters4.09 G MACs
SE-ResNet-5028.09 M parameters4.09 G MACs
Bars show each row's share of the total. Convolutions dominate compute because they run at every position; fully connected layers dominate parameters in older designs (AlexNet, VGG). Changing the input size changes the compute of every convolution but not its parameters. Parameter counts include biases and BatchNorm scale and shift and match torchvision's implementations.
Why engineers care

SE is a drop-in upgrade: add it to an existing backbone for a reliable accuracy gain at almost no compute cost. MobileNetV3 and EfficientNet use it, so it runs on phones, drones and satellites.

📝 Quick check (Level 0)
0/3 answered
  1. 1. SENet adds SE units to…
  2. 2. The SE unit rescales…
  3. 3. SENet won…

Level 1: Beginner

★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.

By hand

  • SE-ResNet block: y = ReLU(x + s ⊙ F(x)), where F is the residual branch and s = σ(W₂ ReLU(W₁·avg(F(x)))) holds the channel gates.
  • Parameters per block (reduction r = 16, with biases): C²/8 + C/16 + C.
    • 256 channels: 8,464; 2,048 channels: 526,464.
  • Across ResNet-50 (blocks 3, 4, 6, 3 with 256, 512, 1,024, 2,048 channels): 2,530,992 extra parameters (+9.9%), giving 28.1 M in total.
  • Compute: about 13.6 M extra multiply–adds (+0.3%), most of it in the pooling and rescaling of large early maps, not in the small FC layers.
  • Where the parameters are:
    • the last stage’s three 2,048-channel blocks hold 62% of the extra parameters;
    • removing SE there leaves +3.7%.
📝 Quick check (Level 1)
0/3 answered
  1. 1. SE parameters for one 2,048-channel block (r = 16):
  2. 2. SE's compute overhead on ResNet-50:
  3. 3. SE rescales…

Level 2: Intermediate

★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.

SE networks in code

Exercise 1.

  • The SE-gated residual equalled ReLU(x + s ⊙ F(x)).
  • A gate near zero turned the block into an identity.
  • Per-block SE parameter counts grew with the square of the channel count.

Practice.

  • Placement: after the last BN of the residual branch, before the addition. The paper’s alternatives, SE before the branch or on the identity path, worked about as well, but SE after the addition was worse.
  • Reduction ratio: r = 16 is the default; accuracy was nearly the same from r = 2 to 16 and slightly worse at 32.
  • Libraries: timm provides seresnet50, seresnext50_32x4d and related models. torchvision’s regnet_y_* models (E8-21) include SE.
  • Trimming: for a parameter budget, drop SE in the last stage first.
class SEBottleneck(Bottleneck):
    def forward(self, x):
        out = self.bn3(self.conv3(self.relu(self.bn2(self.conv2(self.relu(self.bn1(self.conv1(x))))))))
        s = torch.sigmoid(self.fc2(torch.relu(self.fc1(out.mean((2, 3))))))
        return torch.relu(self.shortcut(x) + out * s[:, :, None, None])
🐍 Exercise 1: SE on a residual branch
Implement the SE gate, an SE-gated residual block and the per-block parameter count.
📝 Quick check (Level 2)
0/3 answered
  1. 1. The worst SE placement in the paper:
  2. 2. To trim SE's parameters, drop it first in…
  3. 3. torchvision models that include SE:

Level 3: Advanced

★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.

Theory

What SE adds to a network.

  • Convolutions are local, and every channel is treated the same regardless of image content.
  • SE makes the channel weighting a function of the whole image, a form of dynamic, input-conditioned computation.
  • The gates in early layers were similar across classes (general features); in later layers they became class-specific.
  • In the last stage, gates were often nearly constant (saturated), which is why removing SE there cost little.

Parameters versus compute. SE’s fully connected layers act once per image on C numbers, so their compute is tiny. Their parameters grow as C²/r, largest where C is largest. The pooling and the rescaling act on every activation, so they are the main compute cost, though still small.

Generality. SE improved ResNet, ResNeXt, Inception, Inception-ResNet, MobileNet and ShuffleNet on ImageNet, and also detection on COCO. It became a standard component of later designs (MobileNetV3, EfficientNet, RegNetY).

📝 Quick check (Level 3)
0/3 answered
  1. 1. Late-stage SE gates were often…
  2. 2. SE's compute is mainly in…
  3. 3. SE improved…

Level 4: Expert

★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.

What does SE cost a whole network?

History.

  • J. Hu, L. Shen and G. Sun (2018) introduced SENet at CVPR; a later journal version added S. Albanie and E. Wu.
  • An ensemble of SE-ResNeXt networks won ILSVRC 2017 classification with 2.251% top-5 error, the last year of the challenge.
  • SE was adopted in MobileNetV3, EfficientNet and RegNetY.

Exercise 2. This is a calculation, not a training run. It adds an SE block to each of ResNet-50’s 16 bottlenecks and computes the extra parameters and multiply–adds for several reduction ratios and by stage. It compares the totals with the paper’s SE-ResNet-50 sizes.

reduction r SE-ResNet-50 parameters (M) paper SE multiply–adds (M)
2 45.70 45.7 31.2
4 35.64 35.7 21.1
8 30.60 30.7 16.1
16 28.09 28.1 13.6
32 26.83 26.9 12.3
stage (channels) SE parameters (r = 16) share
256 25,392 1%
512 133,248 5%
1,024 792,960 31%
2,048 1,579,392 62%
  • The calculation reproduces the paper’s parameter counts for every reduction ratio, within 0.1 M.
  • SE costs 10% more parameters but only 0.33% more compute at r = 16; the paper reports 0.26% by its own counting.
  • The last stage holds most of the SE parameters. Removing SE there leaves an overhead of 3.7%, which the paper found cost little accuracy.
🐍 Exercise 2 (research): what does SE cost a whole network?
Compute SE's parameter and compute overhead across ResNet-50 by reduction ratio and by stage, and compare with the paper.

SE in AI, robotics and aerospace

  • Drop-in accuracy: adding SE to an existing detector backbone is a low-risk way to gain accuracy for aerial or driving perception.
  • Efficient networks: SE inside MobileNetV3 and EfficientNet runs on embedded processors aboard drones and small satellites.
  • Parameter budgets: stage-wise trimming of SE helps fit models into tight memory for onboard upload.

References

  1. J. Hu, L. Shen, G. Sun (2018). “Squeeze-and-excitation networks.” Proc. CVPR.
  2. J. Hu, L. Shen, S. Albanie, G. Sun, E. Wu (2019). “Squeeze-and-excitation networks.” IEEE TPAMI 42(8).
  3. I. Radosavovic et al. (2020). “Designing network design spaces.” Proc. CVPR.