CNN Architectures


CNN Architectures

Simon
Alright, so today we're diving into CNN architectures — the big ones that have shaped modern computer vision. We'll go through AlexNet, VGG, GoogLeNet, and ResNet in detail, and then touch on a few others. Ready?

Hope
Absolutely. Let's start with AlexNet, the one that really kicked off the deep learning revolution in 2012. It was the first large CNN to dominate ImageNet, beating all traditional methods by a huge margin.

Simon
Right. The architecture itself was actually pretty similar to LeNet — just much bigger. It had 5 convolutional layers, some pooling, normalization, and then 3 fully connected layers at the end. The input was 227x227x3 images.

Hope
And those early layers used big filters: 11x11 in the first conv layer with stride 4. That gave an output volume of 55x55x96. Each filter was 11x11x3, so 96 of them meant about 35,000 parameters just in that first layer.

Simon
Then they had a pooling layer — 3x3 filters with stride 2 — which reduced spatial size to 27x27 while keeping depth at 96. And pool layers have zero parameters, which is a nice trick question.

Hope
Right, because pooling just applies a fixed rule like max — no learned weights. So you can work through the whole network and calculate sizes and parameters, just like they did in the lecture.

Simon
One notable detail: AlexNet was split across two GPUs because memory was limited then. So half the feature maps were on each GPU, and only certain layers communicated between them. That's why diagrams show two columns.

Hope
Yeah, a historical quirk. They also introduced ReLU nonlinearities, used heavy data augmentation like flipping and cropping, dropout, and trained with SGD with momentum. They even did model ensembling to boost performance.

Simon
Now, after AlexNet came ZFNet in 2013, but that was mostly tweaking hyperparameters. The real leaps came in 2014 with VGG and GoogLeNet — both much deeper, with 16–19 and 22 layers respectively.

Hope
Let's talk about VGG first. It kept it simple: all 3x3 convolutions with periodic pooling. The idea was that stacking three 3x3 layers gives the same receptive field as one 7x7 layer, but with fewer parameters and more nonlinearities.

Simon
Right. Three 3x3 layers have an effective receptive field of 7x7 because each layer adds a border. And the parameter count: three layers with 3x3xCxC each vs one 7x7xCxC — that's 27C^2 vs 49C^2, so fewer parameters.

Hope
VGG 16 had 16 weight layers, VGG 19 had 19. Both had around 138 million parameters — more than double AlexNet's 60 million. And memory usage was heavy: about 100 MB per image just for the forward pass.

Simon
Because most memory is used in early layers where spatial dimensions are large, while most parameters are in the fully connected layers at the end. VGG achieved 7.3% top-5 error on ImageNet, and its FC7 features became a standard representation for transfer learning.

Hope
GoogLeNet, the 2014 winner, was all about computational efficiency. It introduced the Inception module, which applies multiple filter sizes in parallel — 1x1, 3x3, 5x5, and a pooling operation — then concatenates the outputs depth-wise.

Simon
But doing that naively is expensive. For example, with a 28x28x256 input, using 128 1x1 filters, 192 3x3, 96 5x5, and a pooling layer, the output would be 28x28x672, and the total operations would be 854 million.

Hope
That's huge. So they used bottleneck layers: 1x1 convolutions placed before the expensive 3x3 and 5x5 layers, and after pooling, to reduce depth. That brought operations down to 358 million — much more manageable.

Simon
And the 1x1 conv essentially does a linear combination of input feature maps, projecting depth down. It adds nonlinearity too, so it's not just lossy compression — it actually helps. GoogLeNet stacked many Inception modules, with no fully connected layers, ending with a global average pooling.

Hope
They also added auxiliary classifiers at intermediate layers to inject gradient signal earlier, which helped with training in such a deep network. Total parameters? Only 5 million — 12 times fewer than AlexNet — yet it achieved 6.7% top-5 error.

Simon
Then came ResNet in 2015, the real game-changer. The key observation was that deeper plain networks actually perform worse, even on training error — it's not overfitting, it's an optimization problem. A deeper model should at least match a shallower one by copying its layers and adding identity mappings.

Hope
So they designed residual blocks: instead of learning H(x) directly, they learn F(x) = H(x) - x, then output F(x) + x via a shortcut connection. This makes it easy to learn identity — just set F(x) to zero — and helps gradient flow.

Simon
Each block typically has two 3x3 conv layers, and they stack these blocks very deep — up to 152 layers for ImageNet. They also use bottleneck layers for deeper versions: a 1x1 conv reduces depth, then a 3x3 conv, then another 1x1 conv restores depth.

Hope
They used batch normalization, Xavier initialization with scaling, SGD with momentum, and no dropout. The result? 3.6% top-5 error — better than human performance on ImageNet. They swept all competitions that year.

Simon
Comparing the architectures: VGG is the least efficient — high memory and compute. GoogLeNet is the most efficient, with small memory and low operations. ResNet sits in the middle with high accuracy and moderate efficiency.

Hope
Now, briefly, other architectures: Network-in-Network introduced 1x1 conv bottlenecks, inspiring GoogLeNet and ResNet. Wide ResNets argued that width matters more than depth, using more filters per layer to achieve better performance with fewer layers.

Simon
ResNeXt combined width and depth with multiple parallel pathways within a residual block — they call it cardinality. Stochastic Depth randomly drops layers during training to improve gradient flow, then uses the full network at test time.

Hope
FractalNet challenged the necessity of residual connections, using a fractal architecture with both shallow and deep paths. DenseNet connects every layer to every other layer in a dense block, promoting feature reuse and alleviating vanishing gradients.

Simon
And finally, SqueezeNet focuses on efficiency: with Fire modules (a squeeze layer of 1x1 convs followed by an expand layer of 1x1 and 3x3 convs), it matches AlexNet accuracy with 50x fewer parameters, and can be compressed to 0.5 MB.

Hope
So the takeaway? Deeper networks with clever connections like skip connections and bottlenecks are key. But there's ongoing research into width vs depth, residual vs non-residual, and efficiency. For now, ResNet is the go-to architecture.

Simon
Exactly. And next time we'll talk about recurrent neural networks. But for now, we've covered the major CNN architectures — from AlexNet to ResNet and beyond. Great discussion!

Ask anything
We've read this whole study set, so questions about it get the best answers.