Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Look at space and channels separately
A normal convolution does two jobs at once: it looks at a small neighbourhood (space) and mixes all the channels together. Xception splits these jobs. First, each channel is filtered on its own with a small spatial kernel (a depthwise convolution). Then a 1 × 1 convolution mixes the channels at each pixel (a pointwise convolution). Doing the jobs separately is many times cheaper. Building a whole network this way gave an Inception-sized network that was a little more accurate.
Depthwise-separable convolutions are the core of MobileNets, EfficientNets and most networks that run on phones, drones and satellites. Xception showed they work in a full-size, high-accuracy network too.
- 1. A depthwise convolution filters…
- 2. A pointwise convolution is…
- 3. Xception is short for…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Separable convolution:
- depthwise: one k × k kernel per input channel, k²·C_in weights;
- pointwise: C_in·C_out weights.
- For 728 → 728 channels and k = 3 that is 6,552 + 529,984 = 536,536 weights, against 4,769,856 for a full 3 × 3 convolution, 8.9 times fewer.
- Equivalent full kernel: W[o, c] = P[o, c]·D[c]. Every output channel uses the same spatial pattern from input channel c, scaled. Per input channel, the Cout × 9 kernel matrix has rank 1.
- Saving: k²C²/(k²C + C²) = k²C/(k² + C), which approaches k² = 9 for many channels.
- Architecture:
- entry flow: downsampling to 19 × 19 with 728 channels;
- middle flow: 8 repeats of three separable 3 × 3 convolutions at 728 channels, 8·3·536,536 ≈ 12.9 million weights;
- exit flow: up to 2,048 channels, then global average pooling.
- In all there are 36 convolutional layers, mostly with residual connections.
- 1. Separable weights for 728 → 728, k = 3:
- 2. For many channels, the saving approaches…
- 3. Xception's middle flow repeats…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Separable convolutions in code
Exercise 1.
- A depthwise then pointwise convolution matched the full convolution with kernel P[o, c]·D[c].
- The weight counts confirmed the 8.9-fold saving at 728 channels.
Practice.
- In PyTorch:
nn.Conv2d(c, c, 3, padding=1, groups=c)followed bynn.Conv2d(c, c_out, 1). Keras hasSeparableConv2D. - Xception found it better not to put a nonlinearity between the depthwise and pointwise steps, unlike MobileNet’s BN–ReLU after both.
- Xception expects 299 × 299 inputs. The original training used SGD with momentum and also RMSProp; it ran on 60 GPUs for the large JFT dataset.
- Depthwise convolutions have little arithmetic per memory access, so on GPUs they often run slower than their operation count suggests.
sep = nn.Sequential(nn.Conv2d(728, 728, 3, padding=1, groups=728, bias=False), # depthwise
nn.Conv2d(728, 728, 1, bias=False), nn.BatchNorm2d(728)) # pointwise- 1. A depthwise conv in PyTorch uses…
- 2. Between depthwise and pointwise, Xception uses…
- 3. Xception's input size:
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
The hypothesis.
- An Inception module partly separates cross-channel correlations (1 × 1 convolutions) from spatial ones (3 × 3 convolutions on a few channels each).
- Chollet’s “extreme” version applies one spatial convolution to every channel after a 1 × 1, which is equivalent up to order to a depthwise-separable convolution.
- The stronger hypothesis is that cross-channel and spatial correlations can be mapped entirely separately.
A spectrum.
- A full convolution is one end, with one segment containing all channels.
- An Inception module has 3–4 segments.
- A depthwise-separable convolution is the other end, with one segment per channel.
- Grouped convolutions (ResNeXt, E8-11) lie in between.
What it means for kernels. A separable convolution can only represent kernel tensors whose per-input-channel Cout × k² matrix has rank 1. Exercise 2 checks whether ordinary trained convolutions happen to be near that subset. In a small network they were not, so the constraint is real. Networks built from separable convolutions compensate with depth and width, and the pointwise layers mix channels between successive depthwise steps.
Results.
- ImageNet: 79.0% top-1 against 78.2% for Inception v3, at similar size.
- JFT (350 million images): a larger relative gain.
- The author attributed the gains to more efficient use of parameters rather than to more capacity.
- 1. Grouped convs sit between full and depthwise convs in…
- 2. A separable conv's per-input-channel kernel matrix has rank…
- 3. Xception's gains were attributed to…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Do ordinary convolutions learn separable kernels?
History.
- L. Sifre (2014) used depthwise-separable convolutions in his thesis on rigid-motion scattering.
- F. Chollet (2017) introduced Xception at CVPR.
- A. Howard et al. (2017) built MobileNets from the same operation (E8-15).
- Separable convolutions became the basis of efficient architectures (EfficientNet, E8-20) and of DeepLabv3+’s Xception backbone (E10).
Exercise 2. The small network of E8-4 (a stem and two 3 × 3, 8 → 8 layers) is trained on shifted digits. For each learned 8 × 8 × 3 × 3 kernel tensor and for 200 random ones, we compute the share of its energy that a depthwise-separable convolution can represent: the best rank-1 approximation of each input channel’s 8 × 9 matrix. We also compute the share with 2 depthwise kernels per channel (depth multiplier 2).
| 8 → 8 kernel tensors | energy kept, 1 depthwise kernel per channel | 2 per channel |
|---|---|---|
| random Gaussian | 0.366 | 0.609 |
| learned layer 1 | 0.366 | 0.615 |
| learned layer 2 | 0.390 | 0.629 |
- Learned kernels were no more separable than random ones. Training moved the weights a long way (the change was about twice the initial norm), and the change itself was not separable either (0.37 and 0.41). Seed 1 gave the same picture (0.36 and 0.41).
- So ordinary convolutions do not discover separable structure on their own. A separable layer could not reproduce these trained layers.
- Xception’s bet is different: a network built from separable convolutions learns features that suit the constraint, compensating through depth, width and the mixing of the pointwise layers. Its ImageNet result supports that bet at scale; this exercise shows why it is a design choice rather than a free approximation.
Separable convolutions in AI, robotics and aerospace
- Embedded vision: MobileNets and EfficientNets, built from separable convolutions, run detection and segmentation on drones, robots and satellite processors.
- Segmentation: DeepLabv3+ uses a modified Xception backbone, used for land-cover mapping from aerial imagery.
- Hardware note: check depthwise-convolution performance on the target accelerator, since operation counts overstate the speed-up on some GPUs.
References
- F. Chollet (2017). “Xception: deep learning with depthwise separable convolutions.” Proc. CVPR.
- L. Sifre (2014). “Rigid-motion scattering for image classification.” PhD thesis, École Polytechnique.
- A. G. Howard et al. (2017). “MobileNets: efficient convolutional neural networks for mobile vision applications.” arXiv:1704.04861.
- L.-C. Chen et al. (2018). “Encoder-decoder with atrous separable convolution for semantic image segmentation.” Proc. ECCV.