The same sliding-window idea works in any number of dimensions: 1-D convolutions slide along time (audio, sensor streams, text), 2-D along height and width (images, spectrograms), and 3-D along time and space (video, volumetric scans, lidar voxels). The choice decides which patterns a layer can see, and each extra dimension multiplies cost by the kernel size. This page covers the three cases, their shapes and costs, channels versus dimensions, and factorised (2+1)-D designs. In the exercises you build one routine for all three and show a spectrogram's full-height 2-D kernel equals a 1-D convolution with frequency bins as channels, then classify motion direction in tiny videos: per-frame 2-D filters were at chance, frames-as-channels reached 91% and 3-D filters 98%.
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.
Sliding windows in time, space or both
A convolution slides a small window along the data. For a sound or a sensor stream the window slides along time (1-D). For an image it slides across height and width (2-D). For a video or a CT scan it slides across time or depth as well (3-D). What the network can detect depends on where the window can slide: to see motion, a filter must look at several frames at once.
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
Engineering data come in all these shapes: vibration and telemetry (1-D), camera and radar images (2-D), video, lidar voxels and volumetric inspection scans (3-D). Choosing the right convolution, or a factorised mix, decides accuracy and whether the model fits on the hardware.
📝 Quick check (Level 0)
0/3 answered
1. Audio is usually processed with…
2. To detect motion a filter must…
3. Each extra dimension multiplies the cost by…
Level 1: Beginner
★★☆☆☆ Basic⏱ 15 minSecondary-school mathematics: arithmetic and elementary algebra.
By hand
Shapes (channels first):
1-D: (C, T), kernel (C_out, C_in, k);
2-D: (C, H, W), kernel (C_out, C_in, k, k);
3-D: (C, D, H, W), kernel (C_out, C_in, k, k, k).
Weights for 64 → 64, k = 3: 12 288 (1-D), 36 864 (2-D), 110 592 (3-D).
Valid output shape: each dimension shrinks by k − 1: (16, 112, 112) with k = 3 → (14, 110, 110).
Channels versus dimensions: a 2-D convolution over a spectrogram (frequency × time) whose kernel covers every frequency bin is a 1-D convolution over time with frequency bins as channels.
(2+1)-D factorisation: a 3 × 3 spatial convolution to M channels, then a 3-tap temporal one: C_in·M·9 + M·C_out·3 weights.
📝 Quick check (Level 1)
0/3 answered
1. 3-D weights for 64 → 64, k = 3:
2. Valid output of (16, 112, 112) with k = 3:
3. A full-height spectrogram kernel equals…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 20 minUndergraduate students and practising engineers.
Convolutions in code
Exercise 1.
One routine based on sliding windows computed 1-D and 3-D valid convolutions correctly.
A 2-D kernel spanning all 8 frequency bins of a spectrogram gave exactly the 1-D convolution over time with the bins as channels.
Practice.
nn.Conv1d, nn.Conv2d, nn.Conv3d.
For video, consider early fusion (frames as channels), (2+1)-D factorisation (R(2+1)D) or 3-D convolutions on short clips.
For long 1-D signals, use dilated or strided 1-D convolutions to cover long contexts cheaply.
For sparse 3-D data such as lidar voxels, use sparse convolutions that skip empty space.
Implement an n-D valid convolution with sliding windows, test it in 1-D and 3-D, and show a full-height spectrogram kernel is a 1-D convolution with bins as channels.
📝 Quick check (Level 2)
0/3 answered
1. R(2+1)D factorises a 3-D conv into…
2. Lidar voxels are best handled by…
3. Long 1-D contexts are covered cheaply by…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.
Theory
Same operation, different symmetry. A d-dimensional convolution is equivariant to shifts along its d sliding axes. Which axes slide is a modelling choice: frequency in a spectrogram is not translation-invariant in the way time is, so many audio models treat frequency as channels (1-D) or use 2-D convolutions with small frequency kernels.
Temporal information. A filter that sees only one frame produces features independent of frame order; pooling over time then makes the representation completely order-blind, so motion direction is invisible (exercise 2). Early fusion mixes all frames in the first layer; 3-D convolutions build spatio-temporal features gradually and are equivariant in time.
Cost. Parameters and multiply–adds grow as kᵈ. Factorisations such as (2+1)-D and depthwise convolutions (E7-6) reduce this; R(2+1)D also adds a nonlinearity between the spatial and temporal parts, which Tran et al. (2018) found helped.
📝 Quick check (Level 3)
0/3 answered
1. Per-frame filters with pooling over time are…
2. Convolution cost grows with dimension as…
3. Frequency in spectrograms is often treated as…
Level 4: Expert
★★★★★ Expert⏱ 25 minResearchers: original papers and open problems.
Seeing motion
History.
A. Waibel et al. (1989) introduced time-delay neural networks (1-D convolutions for speech).
S. Ji et al. (2013) and D. Tran et al. (2015, C3D) used 3-D convolutions for action recognition.
J. Carreira and A. Zisserman (2017) inflated 2-D networks to 3-D (I3D); D. Tran et al. (2018) proposed R(2+1)D.
Exercise 2. Tiny videos (6 frames of 10 × 10) of a 2 × 2 blob moving one pixel per frame left or right, with noise. Features: 16 fixed random filters with ReLU and global max pooling; a linear readout trained on 200 videos. Three seeds:
features
test accuracy
3 × 3 filters on each frame, max over frames
0.504
3 × 3 filters with the 6 frames as input channels
0.911
3 × 3 × 3 filters (3-D)
0.981
Per-frame filters were at chance: each frame shows a blob; only the order of frames reveals the direction, and pooling over time discards it.
Frames as channels (early fusion) captured motion, and 3-D filters, which see three consecutive frames at every position, did best.
🐍 Exercise 2 (research): seeing motion
Classify the direction of a moving blob with per-frame 2-D filters, frames-as-channels 2-D filters and 3-D filters.
Convolutions of every dimension in AI, robotics and aerospace
Only filters spanning several frames detected motion direction.
Practice
Show:
Level 0
Problem 1Level 0
1-D weights for 64 → 64, k = 3?
12 288.
Problem 2Level 0
Valid output length of a 100-sample signal with k = 5?
96.
Problem 3Level 0
Factor by which a 3-D conv has more weights than a 2-D conv (same channels, k = 3)?
3.
Level 1
Problem 4Level 1
3-D weights for 64 → 64, k = 3?
110 592.
Problem 5Level 1
Valid output width of 112 with k = 3?
110.
Problem 6Level 1
(2+1)-D weights for 64 → 64 with M = 144, k = 3?
82 944 + 27 648 = 110 592, the same as full 3-D (that is how M was chosen).
Problem 7Level 1
Parameters of a 1-D conv 1 → 8 with k = 5 and bias?
40 + 8 = 48.
Level 2
Problem 8Level 2
Per-frame accuracy in exercise 2?
0.504.
Problem 9Level 2
Frames-as-channels accuracy?
0.911.
Problem 10Level 2
3-D accuracy?
0.981.
Problem 11Level 2
Frames per video in exercise 2?
6.
Problem 12Level 2
Weights of 16 random 3 × 3 filters over 6 frame-channels?
16 × 6 × 9 = 864.
Problem 13Level 2
Weights of 16 random 3 × 3 × 3 filters (1 input channel)?
16 × 27 = 432.
Level 3
Problem 14Level 3
Show that a full-height 2-D kernel on a spectrogram equals a 1-D multichannel convolution.
With input S[f, t] of height F and kernel K[f, a] of height F, the 2-D valid output has height 1: y[t] = Σ_f Σ_a S[f, t + a]K[f, a]. A 1-D convolution with F input channels and kernel K[f, :] computes exactly the same sum over channels f and taps a. ∎
Problem 15Level 3
Explain why per-frame filters could not detect direction.
Each frame contains a single blob at some position; a per-frame filter’s response depends only on that frame. Taking the maximum over frames and positions removes both where and when each response occurred, so a left-moving and a right-moving video produce the same set of responses. No readout on these features can separate the classes. ∎
A 3 × 3 × 3 filter sees three consecutive frames at every position and time, so the same motion detector is applied throughout the video and its maximum responds wherever the blob passes. A frames-as-channels filter must detect the whole 6-frame trajectory within a 3 × 3 spatial window, but the blob moves 5 pixels over the clip, so each filter sees only part of the motion at any position, a harder pattern for random filters. ∎
Problem 17Level 3
Advise an architecture for detecting cracks in volumetric CT scans of turbine blades.
Use 3-D convolutions (a 3-D U-Net, E10-2) on patches of the volume so filters see the crack’s extent in all three dimensions, with anisotropic kernels if the slice spacing differs from in-plane resolution. To control memory, process overlapping patches and consider (2+1)-D or sparse convolutions. Train with augmentations that respect the physics (rotations, intensity changes) and validate on blades from separate batches. ∎
Level 4
Problem 18Level 4
Gain of 3-D over frames-as-channels?
0.981 − 0.911 = 0.07.
Problem 19Level 4
Training videos in exercise 2?
200.
Problem 20Level 4
Gain of 3-D over per-frame filters?
0.981 − 0.504 = 0.477.
Coding practice
🐍 Code 1 (Level 0): parameters
C_out·C_in·kᵈ (+ C_out).
🐍 Code 2 (Level 0): valid output shape
Each dimension minus k − 1.
🐍 Code 3 (Level 1): (2+1)-D weights
C_in·M·k² + M·C_out·k.
🐍 Code 4 (Level 1): multiply–adds
Output size × C_in·C_out·kᵈ.
🐍 Code 5 (Level 1): multichannel 1-D conv
Valid convolution, (C_in, T) × (C_out, C_in, k).
Topic test
A timed test drawn at random from this topic's question bank. Each attempt gets new questions. For a longer test across the whole chapter, see the chapter test, or mix topics in the question bag.
1-D, 2-D and 3-D Convolutions: topic test
10 questions, drawn at random from a bank of 21. Every attempt is different.
⏱ Time limit: 15 minutes. The test submits itself when time runs out.
Levels covered: 0, 1, 2, 3, 4. No hints or solutions until you submit.