Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Mixing channels, pixel by pixel
A colour image has three numbers per pixel; deep inside a CNN there may be hundreds (channels). A 1×1 convolution does not look at neighbours at all. At each pixel it takes the vector of channel values and multiplies it by a learned matrix, producing a new set of channels. It can shrink 256 channels to 64 before an expensive layer, expand them again after, or, with a nonlinearity, compute a small neural network at every pixel.
1×1 convolutions are everywhere in efficient networks: ResNet bottlenecks, Inception modules, MobileNet’s pointwise layers, and the projections in transformers’ feed-forward blocks. They are often where most of a mobile network’s computation goes, so they dominate latency on embedded hardware.
- 1. A 1×1 convolution mixes…
- 2. It is equivalent to…
- 3. A common use is to…
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
- Operation: y[:, i, j] = W·x[:, i, j] + b, with W of size C_out × C_in. Example: two channels [[0, 1], [2, 3]] and [[4, 5], [6, 7]] mixed by W = [1, 1] give [[4, 6], [8, 10]].
- Parameters: C_in·C_out (+ C_out): 16 448 for 256 → 64 with bias.
- Cost: C_in·C_out·H·W multiply–adds: 51.4 million for 256 → 64 on a 56 × 56 map.
- Bottleneck: 1×1 (256 → 64), 3×3 (64 → 64), 1×1 (64 → 256): 16 384 + 36 864 + 16 384 = 69 632 weights, against 589 824 for a plain 3×3 (256 → 256), 8.5 times fewer.
- Network in network: 1×1 conv → ReLU → 1×1 conv computes an MLP on each pixel’s channel vector.
- 1. Weights of a 1×1 conv 64 → 256 (no bias):
- 2. Bottleneck weights for 256 and width 64:
- 3. Two 1×1 layers with a ReLU form…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 20 minUndergraduate students and practising engineers.1×1 convolutions in code
Exercise 1.
- The 1×1 convolution matched an explicit per-pixel matrix product.
- The ResNet bottleneck (256 → 64 → 64 → 256) had 69 632 weights, against 589 824 for a plain 3×3 layer.
Practice.
nn.Conv2d(C_in, C_out, kernel_size=1), or equivalentlynn.Linearon channels-last tensors.- On GPUs a 1×1 convolution is a single large matrix multiplication, usually efficient; on mobile hardware it often dominates runtime, so channel widths matter.
- Put normalisation and activation after each 1×1 in bottlenecks, and consider a final 1×1 without activation before a residual addition.
bottleneck = torch.nn.Sequential(torch.nn.Conv2d(256, 64, 1, bias=False), torch.nn.BatchNorm2d(64), torch.nn.ReLU(),
torch.nn.Conv2d(64, 64, 3, padding=1, bias=False), torch.nn.BatchNorm2d(64), torch.nn.ReLU(),
torch.nn.Conv2d(64, 256, 1, bias=False), torch.nn.BatchNorm2d(256))- 1. On a GPU a 1×1 conv is computed as…
- 2. On mobile hardware 1×1 convs often…
- 3. nn.Linear on channels-last tensors equals…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Per-pixel linear map. A 1×1 convolution is the linear map I_(HW) ⊗ W on the flattened feature map: the same C_out × C_in matrix applied at all H·W positions. Its expressiveness across channels is exactly that of a linear layer.
Low-rank factorisation. The bottleneck factorises a C × C × 3 × 3 convolution through a narrower r-channel space, a low-rank approximation of the full kernel’s channel structure. If learned features are approximately low-rank across channels, little is lost; this is why bottlenecks work.
Cross-channel correlations. Lin, Chen and Yan (2014) argued that a linear filter followed by a nonlinearity is a weak feature extractor and replaced it by a micro-MLP (1×1 convolutions) at each position. Inception and Xception build on separating spatial filtering from channel mixing.
XOR across channels. A single linear 1×1 layer followed by a threshold can only separate channel vectors with a hyperplane; rules like “channels 0 and 1 have the same sign” are not linearly separable, so a nonlinearity between 1×1 layers is needed (exercise 2).
- 1. A bottleneck approximates a convolution by…
- 2. Network in Network was proposed by…
- 3. The same-sign rule needs…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.Linear versus nonlinear channel mixing
History.
- M. Lin, Q. Chen and S. Yan (2014) introduced Network in Network with 1×1 convolutions.
- C. Szegedy et al. (2015) used 1×1 reductions in Inception; K. He et al. (2016) in ResNet bottlenecks.
- A. Howard et al. (2017) used pointwise 1×1 layers in MobileNet.
Exercise 2. Images with 4 channels of Gaussian noise; each pixel’s label is whether channels 0 and 1 have the same sign. Networks of 1×1 layers only, trained with Adam on 20 images (1280 pixels), tested on 50 new images. Two seeds:
| 1×1 layers | pixel accuracy |
|---|---|
| one linear 1×1 convolution | 0.475 |
| 1×1 (4 channels) + ReLU + 1×1 | 0.977 |
| 1×1 (16 channels) + ReLU + 1×1 | 0.992 |
- A single linear 1×1 layer stayed at chance: the rule is XOR-like in channel space.
- Two 1×1 layers with a ReLU learned it with as few as 4 hidden channels.
- Lesson: 1×1 convolutions add nonlinear cross-channel processing only when combined with activations.
1×1 convolutions in AI, robotics and aerospace
- Efficient backbones (ResNet-50, MobileNet, EfficientNet) for onboard perception rely on 1×1 layers.
- Multispectral imagery: 1×1 layers combine spectral bands at each pixel, for example to classify land cover or detect plumes in satellite data.
- Prediction heads: detection and segmentation heads end in 1×1 convolutions that map features to class scores per position.
References
- M. Lin, Q. Chen, S. Yan (2014). “Network in network.” Proc. ICLR.
- C. Szegedy et al. (2015). “Going deeper with convolutions.” Proc. CVPR.
- K. He, X. Zhang, S. Ren, J. Sun (2016). “Deep residual learning for image recognition.” Proc. CVPR.