Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Filter space and mix channels separately
A standard convolution does two jobs at once: it looks at a spatial neighbourhood and it combines all input channels, with a separate 3 × 3 filter for every pair of input and output channels. A depthwise separable convolution does the jobs one after the other: first each channel gets its own small spatial filter (depthwise), then a 1×1 convolution mixes the channels (pointwise). It gives up some flexibility but costs a fraction as much.
Separable convolutions made real-time vision possible on phones, drones and microcontrollers: MobileNet, Xception, EfficientNet and many embedded detectors use them. For the same compute, a network can be wider or deeper, which often more than compensates for the restriction.
- 1. The depthwise step filters…
- 2. The pointwise step is…
- 3. Separable convolutions are the basis of…
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Depthwise: C_in filters of size k × k, one per channel: C_in·k² weights.
- Pointwise: C_in·C_out weights.
- Standard: C_in·C_out·k² weights.
- Ratio: (C_in·k² + C_in·C_out)/(C_in·C_out·k²) = 1/C_out + 1/k². For C_out = 256, k = 3: 0.115, about 8.7 times cheaper. Multiply–adds scale the same way: H·W·(C_in·k² + C_in·C_out).
- Example: 64 → 128 channels with 3 × 3 kernels: separable 576 + 8192 = 8768 weights; standard 73 728.
- Equal budget: with 2304 weights and 16 input channels, a standard 3 × 3 layer affords 16 output channels; a separable layer affords (2304 − 144)/16 = 135.
- 1. Separable weights for 64 → 128, 3 × 3:
- 2. Cost ratio for 256 outputs, 3 × 3:
- 3. Output channels for 2304 weights, 16 inputs, separable:
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 20 minUndergraduate students and practising engineers.Separable convolutions in code
Exercise 1.
- Depthwise then pointwise equalled a standard convolution with kernel K[o, c] = P[o, c]·D[c].
- For each input channel, the separable layer’s six spatial filters had rank 1 (all scaled copies of one filter), against rank 6 for a general kernel.
- The cost ratio for 256 output channels was 0.115.
Practice.
- In PyTorch:
nn.Conv2d(C, C, 3, padding=1, groups=C)followed bynn.Conv2d(C, C_out, 1). - MobileNet places normalisation and activation after both steps; MobileNetV2 inverts the order inside a residual block (E8-16).
- On GPUs the depthwise step has low arithmetic intensity and may not speed up as much as the operation count suggests; on mobile CPUs and NPUs it usually does.
sep = torch.nn.Sequential(torch.nn.Conv2d(64, 64, 3, padding=1, groups=64, bias=False), torch.nn.BatchNorm2d(64), torch.nn.ReLU(),
torch.nn.Conv2d(64, 128, 1, bias=False), torch.nn.BatchNorm2d(128), torch.nn.ReLU())- 1. A depthwise conv in PyTorch uses…
- 2. On GPUs, depthwise convs may be slower than expected because of…
- 3. The separable kernel for output o and input c is…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
What is lost. A standard layer has an independent spatial filter for every (output, input) pair. A separable layer uses one spatial filter per input channel, shared by all outputs up to a scalar. It is a constrained subset of standard convolutions, so it can represent fewer functions per layer.
Why it works anyway. Chollet (2017) argued, with Xception, that cross-channel and spatial correlations in feature maps are largely decoupled, so mapping them separately loses little. The saved compute can buy more channels or layers, which matters more.
Equal budgets. At a fixed number of weights, a separable layer can be about k² times wider. More, cheaper features often help, as exercise 2 shows with random features; with trained networks MobileNet reached near-VGG accuracy with about 30 times less computation.
Related factorisations. Spatially separable kernels (k × 1 then 1 × k), grouped convolutions (E7-7), and low-rank tensor decompositions are other ways to trade flexibility for cost.
- 1. Xception's premise is that spatial and channel correlations are…
- 2. At equal weights, a separable layer can be about…
- 3. A k × 1 then 1 × k kernel is…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Spending the savings
History.
- L. Sifre (2014) studied depthwise separable convolutions in his thesis.
- F. Chollet (2017) built Xception from them; A. Howard et al. (2017) MobileNet.
- M. Sandler et al. (2018) introduced inverted residuals (MobileNetV2); M. Tan and Q. Le (2019) EfficientNet.
Exercise 2. A random first layer of 16 3 × 3 filters, then a second layer with a budget of 2304 weights, either standard 3 × 3 (16 output channels) or depthwise 3 × 3 plus pointwise 1 × 1 (135 output channels); global max pooling and a linear readout trained on 200 images of shapes placed anywhere. Three seeds:
| second layer | output channels | test accuracy |
|---|---|---|
| standard 3 × 3 | 16 | 0.733 |
| depthwise + pointwise | 135 | 0.904 |
- For the same weights, the separable layer was more than eight times wider and gave the readout much more useful features.
- Caveat: these are random, untrained features; with training the gap depends on the task, but the trade of flexibility for width is the reason separable networks are efficient.
Separable convolutions in AI, robotics and aerospace
- Embedded perception on drones and small robots (MobileNet-SSD, EfficientDet-Lite).
- Satellite onboard processing, where power budgets are a few watts.
- Keyword spotting and audio events on microcontrollers with separable 1-D/2-D convolutions.
References
- F. Chollet (2017). “Xception: deep learning with depthwise separable convolutions.” Proc. CVPR.
- A. Howard et al. (2017). “MobileNets: efficient convolutional neural networks for mobile vision applications.” arXiv:1704.04861.
- M. Sandler, A. Howard, M. Zhu, A. Zhmoginov, L.-C. Chen (2018). “MobileNetV2: inverted residuals and linear bottlenecks.” Proc. CVPR.
- L. Sifre (2014). “Rigid-motion scattering for image classification.” PhD thesis, École Polytechnique.