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

Xception

Xception (Chollet, 2017), 'extreme Inception', takes the Inception idea to its limit. It assumes that correlations across channels and correlations across space can be mapped completely separately, and builds the whole network from depthwise-separable convolutions with residual connections. With about the same number of parameters as Inception v3 (22.9 million), it was slightly more accurate on ImageNet and clearly better on the larger JFT dataset. This page covers the separable convolution, its cost, the entry, middle and exit flows, and the hypothesis behind them. In the exercises you show that a separable convolution equals a full convolution with a constrained kernel, then test the hypothesis on learned kernels: ordinary 3 × 3 layers did not learn separable kernels (only 37–39% of their energy fits), so Xception's success comes from networks adapting to the constraint.

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.

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

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.

📝 Quick check (Level 0)
0/3 answered
  1. 1. A depthwise convolution filters…
  2. 2. A pointwise convolution is…
  3. 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.
📝 Quick check (Level 1)
0/3 answered
  1. 1. Separable weights for 728 → 728, k = 3:
  2. 2. For many channels, the saving approaches…
  3. 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 by nn.Conv2d(c, c_out, 1). Keras has SeparableConv2D.
  • 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
🐍 Exercise 1: depthwise then pointwise
Implement depthwise and pointwise convolutions, the equivalent full kernel, and the parameter count.
📝 Quick check (Level 2)
0/3 answered
  1. 1. A depthwise conv in PyTorch uses…
  2. 2. Between depthwise and pointwise, Xception uses…
  3. 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.
📝 Quick check (Level 3)
0/3 answered
  1. 1. Grouped convs sit between full and depthwise convs in…
  2. 2. A separable conv's per-input-channel kernel matrix has rank…
  3. 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.
🐍 Exercise 2 (research): are learned kernels separable?
Train a small CNN, then measure how much of its kernels a depthwise-separable convolution could represent, against random kernels.

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

  1. F. Chollet (2017). “Xception: deep learning with depthwise separable convolutions.” Proc. CVPR.
  2. L. Sifre (2014). “Rigid-motion scattering for image classification.” PhD thesis, École Polytechnique.
  3. A. G. Howard et al. (2017). “MobileNets: efficient convolutional neural networks for mobile vision applications.” arXiv:1704.04861.
  4. L.-C. Chen et al. (2018). “Encoder-decoder with atrous separable convolution for semantic image segmentation.” Proc. ECCV.