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

MobileNet v1

MobileNet v1 (Howard et al., 2017) built an entire network from depthwise-separable convolutions for phones and embedded devices: 4.2 million parameters and 569 million multiply–adds for 70.6% ImageNet top-1 accuracy, close to VGG-16's 71.5% at 27 times less compute. Two global knobs, the width multiplier α and the resolution multiplier ρ, trade accuracy for cost to fit any budget. This page covers the separable-convolution cost formula, the 28-layer architecture and the two multipliers. In the exercises you derive the 1/N + 1/D_K² cost ratio, then rebuild the network's cost model and reproduce the paper's tables exactly: 569, 325, 149 and 41 million multiply–adds for α = 1, 0.75, 0.5 and 0.25.

Level 0: Foundation

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

A network sized for a phone

Phones, drones and small robots cannot run a VGG: too slow, too power-hungry. MobileNet replaces every ordinary convolution with the two-step depthwise-then-pointwise version (E8-13), which is about 8 to 9 times cheaper. It then gives engineers two dials: make every layer thinner (width multiplier α), or feed it smaller images (resolution multiplier ρ). Turning the dials gives a family of models from tiny and fast to larger and more accurate.

CNN building blocks
parameters (no bias): standard 73,728 · grouped (g = 1) 73,728 · depthwise separable 8,768 (8.4× fewer) · multiply–adds per image: 231.2 M vs 27.5 M
Deep-learning "convolution" slides a small learned kernel over the input (no flip). Stride shrinks the output, padding preserves borders, dilation spreads the kernel to see further without more weights. Pooling summarises windows. Stacking layers grows the receptive field. Depthwise-separable and grouped convolutions cut cost by not connecting every input channel to every output channel. Transposed convolution upsamples, but uneven kernel overlap leaves checkerboard patterns. Squeeze-and-excitation rescales whole channels by gates computed from their global averages; CBAM adds a per-pixel spatial gate. (Here the gates are fixed functions of the averages so you can see their effect; in a network the excitation is learned.)
Why engineers care

MobileNets are the standard backbone for on-device detection and segmentation (SSD-MobileNet, DeepLab-MobileNet) on phones, drones, robots and small satellites, where power and latency budgets are tight.

📝 Quick check (Level 0)
0/3 answered
  1. 1. MobileNet replaces convolutions with…
  2. 2. The width multiplier α makes layers…
  3. 3. The resolution multiplier shrinks…

Level 1: Beginner

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

By hand

  • Standard cost: D_K²·M·N·D_F² multiply–adds (kernel D_K, M input channels, N output channels, D_F × D_F output).

  • Separable cost: D_K²·M·D_F² (depthwise) + M·N·D_F² (pointwise).

    • The ratio is 1/N + 1/D_K²; for 3 × 3 kernels and N = 512 it is 0.113, about 8.8 times fewer.
    • At 14 × 14 with 512 → 512 channels: 462.4 M standard against 52.3 M separable multiply–adds.
  • Where the cost goes: the pointwise share is M·N/(D_K²M + MN) = N/(9 + N), so 98% at N = 512. Of the whole network, 95% of compute and 75% of parameters are in 1 × 1 convolutions.

  • Multipliers: cost ≈ D_K²·αM·ρ²D_F² + αM·αN·ρ²D_F², so roughly α² and ρ². Parameters scale with α² but not ρ.

  • Architecture:

    • a 3 × 3 stride-2 convolution to 32 channels;
    • 13 separable layers (64 → 1,024 channels, five with stride 2);
    • global average pooling and a fully connected layer.

    That is 28 layers counting depthwise and pointwise separately.

📝 Quick check (Level 1)
0/3 answered
  1. 1. Separable/standard cost ratio:
  2. 2. Share of MobileNet's compute in 1 × 1 convs:
  3. 3. The resolution multiplier changes…

Level 2: Intermediate

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

MobileNet in code

Exercise 1.

  • The separable cost matched the 1/N + 1/D_K² ratio exactly.
  • A 512 → 512 layer at 14 × 14 needed 52.3 M multiply–adds against 462.4 M for a standard convolution.
  • The width multiplier scaled the cost as predicted.

Practice.

  • Each separable layer is a depthwise 3 × 3 convolution, BN and ReLU, followed by a pointwise 1 × 1 convolution, BN and ReLU.
  • Training:
    • RMSProp with asynchronous gradient descent;
    • less regularisation and augmentation than for large models, because small models overfit less;
    • little or no weight decay on the depthwise filters, which have very few parameters.
  • Deployment:
    • quantise to 8 bits with care: depthwise layers with ReLU6 and per-channel scales quantise better;
    • measure latency on the device, because depthwise layers have low arithmetic intensity.
def sep(cin, cout, s):
    return nn.Sequential(nn.Conv2d(cin, cin, 3, s, 1, groups=cin, bias=False), nn.BatchNorm2d(cin), nn.ReLU(),
                         nn.Conv2d(cin, cout, 1, bias=False), nn.BatchNorm2d(cout), nn.ReLU())
🐍 Exercise 1: separable cost
Compute standard and separable costs, their ratio, and the effect of the multipliers.
📝 Quick check (Level 2)
0/3 answered
  1. 1. MobileNet v1 was trained with…
  2. 2. Depthwise filters need…
  3. 3. Each separable layer is followed by…

Level 3: Advanced

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

Theory

Why separable convolutions save so much. A standard convolution combines filtering and channel mixing in one step, costing D_K²·M·N per position. Splitting them costs D_K²·M + M·N. When N is large the second term dominates, and the saving approaches D_K² = 9.

Where the compute goes. After the split, the 1 × 1 convolutions dominate. They are dense matrix multiplications, which run efficiently with general matrix-multiply routines, so the theoretical saving largely becomes real speed on CPUs. Depthwise layers, though cheap in operations, have low arithmetic intensity and can be memory-bound.

Two multipliers, one budget.

  • Width (α) shrinks parameters and compute together.
  • Resolution (ρ) shrinks only compute and activation memory.
  • In the paper, accuracy fell smoothly with either. Plotting accuracy against compute across all 16 combinations gave a roughly log-linear trade-off. Thinner networks were better than shallower ones at the same cost.

Comparison.

  • MobileNet 1.0: 70.6% with 569 M multiply–adds and 4.2 M parameters.
  • VGG-16: 71.5% with 15.3 G and 138 M.
  • GoogLeNet: 69.8% with 1.55 G and 6.8 M.
📝 Quick check (Level 3)
0/3 answered
  1. 1. For large N, the separable saving approaches…
  2. 2. Depthwise layers can be…
  3. 3. At the same cost, the paper found…

Level 4: Expert

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

Can we reproduce MobileNet’s cost tables?

History.

  • A. Howard, M. Zhu, B. Chen, D. Kalenichenko, W. Wang, T. Weyand, M. Andreetto and H. Adam (2017) introduced MobileNets at Google.
  • MobileNets followed Xception’s separable convolutions (E8-13) and were followed by MobileNetV2 (E8-16), MobileNetV3 (E8-17) and EfficientNet (E8-20).
  • They became the default backbone of TensorFlow Lite’s on-device vision models.

Exercise 2. This is a calculation, not a training run. It implements MobileNet v1’s layer list and counts multiply–adds and weights as the width multiplier and input resolution vary, then compares with the paper’s Tables 6 and 7. The accuracies are the paper’s.

width multiplier M multiply–adds (paper) M parameters (paper) paper top-1
1.0 568.7 (569) 4.21 (4.2) 70.6%
0.75 325.4 (325) 2.57 (2.6) 68.4%
0.5 149.5 (149) 1.32 (1.3) 63.7%
0.25 41.0 (41) 0.46 (0.5) 50.6%
resolution M multiply–adds (paper) paper top-1
224 568.7 (569) 70.6%
192 418.1 (418) 69.1%
160 290.7 (290) 67.2%
128 186.4 (186) 64.4%
  • The cost model reproduces both tables to within one million multiply–adds.
  • Halving the width divides compute by 3.8, close to the factor 4 the α² rule predicts (the depthwise term scales only with α), and parameters by 3.2.
  • Going from 224 to 128 pixels divides compute by 3.1 and leaves parameters unchanged.
  • The two knobs trade accuracy for compute along similar curves: half width gave 63.7% at 149 M; 128-pixel inputs gave 64.4% at 186 M. Width additionally saves parameters; resolution saves activation memory.
🐍 Exercise 2 (research): reproducing MobileNet's cost tables
Implement MobileNet v1's cost model and compare multiply–adds and parameters with the paper as the width and resolution change.

MobileNets in AI, robotics and aerospace

  • On-device detection: SSD-MobileNet detectors run on drones and robots for obstacle, person and vehicle detection.
  • Earth observation: small satellites such as ESA’s Φ-sat-1 have run compact CNNs onboard to discard cloudy images before downlink, the kind of budget MobileNets are designed for.
  • Budgeting: α and ρ let one design fit many processors, from microcontrollers to embedded GPUs.

References

  1. A. G. Howard et al. (2017). “MobileNets: efficient convolutional neural networks for mobile vision applications.” arXiv:1704.04861.
  2. F. Chollet (2017). “Xception: deep learning with depthwise separable convolutions.” Proc. CVPR.
  3. B. Jacob et al. (2018). “Quantization and training of neural networks for efficient integer-arithmetic-only inference.” Proc. CVPR.