AI & Machine Learning · Paper 01 / 05

ImageNet Classification with Deep Convolutional Neural Networks

Alex Krizhevsky, Ilya Sutskever, Geoffrey E. Hinton

2012 · NeurIPS · ~11 min read

Read the original paper

Trains an eight-layer convolutional network on two GPUs and cuts the best ImageNet top-5 error by about 40 per cent. Read it to see how ReLU, dropout, augmentation and GPU code turned an old idea into one that worked.

In 2011, a program that had to tell a photograph of a dalmatian from one of a fire hydrant did not get to decide what to look at. It ran a feature extractor that a researcher had designed by hand, usually SIFT or HOG, which summarised small patches of the image as histograms of edge directions. Those descriptors were pooled into one long vector per image and a linear classifier was trained on the vectors. Years of doctoral work went into the extractors. The classifier was the only part that learned anything from the data.

On the ImageNet challenge (1.2 million training photographs, 1,000 categories) the 2011 winner still missed the correct label in its top five guesses on about a quarter of the test images. In 2012 a team of three from Toronto entered a network that learned everything from raw pixels. Its top-5 error was 15.3 per cent; the second-best entry was at 26.2. A gap that size had not been seen on the benchmark before.

This explainer walks through what that network computed, works one filter by hand, counts where its sixty million parameters sit, and shows why four specific decisions (ReLU, GPUs, data augmentation and dropout) separated a known idea from a working one. By the end you should be able to read the paper’s architecture section and say what problem each choice was solving, and what it cost.

Why the hand-built pipeline stopped improving

A hand-designed descriptor answers a fixed question: which edge orientations are present in this patch? That is a good first question. The trouble is the second and third questions. Is this arrangement of edges a dog’s ear, or a leaf? Are these two ears and a snout a face? The old pipelines never learned those intermediate concepts. They jumped from edge statistics straight to “dalmatian”, and a linear classifier on top can only weigh the evidence it is given.

before 2012imageSIFT / HOG featuresencode, poolSVM“cat” 74%designed by people, fixedAlexNetimage5 convolutional layers + 3 fully connected · 60 million weights, all learned from the pixels“cat” 84%
The old pipeline fixed its features and trained only the last step. AlexNet trained every step from pixels, so the intermediate concepts were learned too.

Convolutional networks that learned all the stages already existed. LeCun’s networks read handwritten digits on cheques in the 1990s. The common view in 2011 was that they did not scale: they were slow to train, and with millions of free weights they memorised small datasets rather than generalising. Two things had changed by 2012. ImageNet supplied a labelled dataset a thousand times larger than the digit sets, and NVIDIA’s CUDA made graphics cards programmable for general arithmetic. The paper’s contribution is the set of choices that turned those two facts into a network that trained in a week and did not overfit.

One filter, worked by hand

A convolutional layer slides a small grid of weights across the image and, at each position, multiplies the weights by the pixels underneath and adds the products. Take a 3×3 filter that responds to a vertical edge where the image gets brighter towards the right:

filter          patch A         patch B         patch C
-1  0  1        0  0  1         1  1  1         1  1  0
-2  0  2        0  0  1         1  1  1         1  1  0
-1  0  1        0  0  1         1  1  1         1  1  0

On patch A, only the right-hand column is lit, so the sum is 1 + 2 + 1 = 4. Patch B is uniformly bright: the left column contributes −4, the right column +4, and the response is 0. Patch C has the edge the other way round, and the response is −4. A bias is added, and then the ReLU keeps the positive part: max(0, x). With a bias of zero, the outputs are 4, 0 and 0. The layer has said, at each location, “a dark-to-light vertical edge is here” or “it is not”.

Now change one thing. Shift the edge in patch A one pixel to the right in the original image. The same nine weights are applied at every position, so the strong response moves one position to the right in the output map. Nothing has to be relearned. That is weight sharing, and it is the assumption that makes convolution cheap: a feature that is useful in one part of the image is useful everywhere. A pooling layer that follows takes the maximum over small neighbourhoods, so a one-pixel shift often leaves the pooled output unchanged.

Try itPaint an image, slide a filter over it

Click pixels to toggle them. The output is the filter's response at each position: a feature map. A deep network stacks dozens of these, each layer reading the maps of the one below.

input · 8 × 8 (click to paint)
3 × 3 filter
-1
0
1
-2
0
2
-1
0
1
responds where brightness changes left to right
feature map · 6 × 6
positive response in teal, negative in red
ImageNet top-5 error of the winning entry, by year
01020302010201220142016yeartop-5 error, %

Before 2012 the winners used features designed by hand (edges, corners, colour histograms) and the error fell a point or two a year. AlexNet learned its filters from the pixels and cut the error from 25.8% to 16.4% in one step. Every winner since has been a deeper network of the same kind, and the 2015 entry passed the estimated human error of about 5%.

AlexNet did not use hand-written filters like this one. Its first layer had 96 filters of 11×11 pixels over three colour channels, applied every fourth pixel, and all their weights were learned. When the authors plotted them (Figure 3 of the paper), most looked like oriented edge detectors and colour blobs. The network had rediscovered roughly what SIFT encoded, and then it went on to learn the layers that SIFT did not have.

Predict first

AlexNet has about 60 million parameters across five convolutional layers and three fully connected layers. Before reading on, guess what share of the parameters are in the three fully connected layers.

Show the worked answer

About 96 per cent. The first fully connected layer takes the last convolutional output, 6×6×256 = 9,216 numbers, and connects every one to each of 4,096 units: 37.7 million weights in one layer. The second is 4,096 × 4,096 = 16.8 million, and the output layer is 4,096 × 1,000 = 4.1 million. That is 58.6 million. All five convolutional layers together hold about 2.3 million.

The arithmetic runs the other way. The convolutional layers apply their small filters at thousands of positions, so they perform roughly 90 per cent of the multiply-adds. The parameters, and so the risk of memorising, live in the fully connected layers; the time lives in the convolutions.

Where the sixty million parameters live

The split in that answer explains where the paper aimed its fixes. Here is the count, layer by layer, using the shapes in the paper. The second, fourth and fifth convolutional layers see only 48 or 192 input channels rather than 96 or 384 because the network was cut in half across two GPUs, and those layers only read the maps on their own card.

layerfilters or unitsweights (approx.)multiply-adds per image (approx.)
conv196 × 11×11×3, stride 435 thousand105 million
conv2256 × 5×5×48307 thousand224 million
conv3384 × 3×3×256885 thousand150 million
conv4384 × 3×3×192664 thousand112 million
conv5256 × 3×3×192442 thousand75 million
fc69,216 → 4,09637.7 million37.7 million
fc74,096 → 4,09616.8 million16.8 million
fc84,096 → 1,0004.1 million4.1 million

Compare the first row with a fully connected alternative. A 224×224 colour image is 150,528 numbers. Connecting it to a modest 1,000 hidden units would take about 150 million weights, more than the whole of AlexNet, and those units would have to learn the same edge detector separately for every location. The convolution gets 96 learned detectors, usable anywhere, for 35 thousand weights.

224×224×3conv 11×11conv 5×5conv 3×3conv 3×3conv 3×3fc 4096fc 4096softmax 1000top half: GPU 1bottom half: GPU 23 GB each; they talk at two layersearly layers see edges and colours; later layers see parts and objects
The architecture as the paper drew it: five convolutional layers that shrink the image while adding channels, three fully connected layers, a 1,000-way softmax. Each layer is split between two 3 GB GPUs, which exchange data only at certain layers.

Four decisions that made it trainable

ReLU. Networks of the time mostly used tanh or the logistic sigmoid as the non-linearity. Both flatten out for large inputs. The slope of tanh at an input of 3 is about 0.01, so a unit in that range passes back a hundredth of the error signal, and the weights feeding it barely move. ReLU’s slope is exactly 1 for any positive input. The paper’s Figure 1 shows a small four-layer network on CIFAR-10 reaching 25 per cent training error about six times faster with ReLUs than with tanh. At the scale of a week-long run, a six-fold difference decides whether the experiment can be done at all.

Two GPUs. The authors trained on two NVIDIA GTX 580 cards with 3 GB of memory each, using CUDA code Krizhevsky wrote himself. Ninety passes over the 1.2 million images took five to six days. The network did not fit on one card, so half the filters of each layer live on each GPU and the halves exchange activations only at the third convolutional layer and in the fully connected layers. The paper reports that this two-card network beat a one-card network with half as many filters per layer by 1.7 points of top-1 error. The split was a memory workaround that happened to cost little accuracy.

Data augmentation. Every training image was resized to 256×256, and on each pass the network saw a random 224×224 crop of it, possibly mirrored left to right. There are 32 × 32 crop positions and two orientations, so one photograph becomes 2,048 slightly different training examples. The variants are highly correlated, so this is not 2,048 times more information, but it stops the network from memorising exact pixel positions. A second trick perturbed the colours along the principal components of the dataset’s RGB values, which the paper says cut top-1 error by over a point. At test time the network averaged its predictions over ten crops (four corners and the centre, plus their mirrors), which multiplies inference cost by ten.

Dropout. During training, each unit in the first two fully connected layers is set to zero with probability 0.5 on every example. A unit cannot rely on any particular partner being present, so it has to learn features that are useful on their own. At test time all units are kept and their outputs are halved to keep the expected input the same. Dropout had been proposed by Hinton’s group earlier that year; this was its first big public result.

decisionproblem it addressedwhat the paper reportswhat it cost
ReLU instead of tanhslow learning when units saturateabout 6× faster to a fixed training error on a small benchmarkunbounded outputs; the paper added a normalisation step to compensate
two GPUs, hand-written CUDAa week of training instead of months; 3 GB memory ceilingsplit network beat a half-width single-GPU network by 1.7 top-1 pointsan architecture shaped by memory, with custom communication code
random crops, flips, colour shiftsmemorising exact imagescolour shifts alone: over 1 point of top-1ten forward passes per test image
dropout in fc6 and fc7overfitting in the 58 million fully connected weightswithout it, “substantial overfitting”roughly twice as many iterations to converge
local response normalisationlarge ReLU outputs drowning neighbours1.4 points of top-1later found unnecessary and dropped

Take dropout out and watch it fail

The paper gives a rough way to see why overfitting was the central risk. With 1,000 classes, each training label carries about 10 bits of information (210 ≈ 1,000). The 1.2 million labels supply around 12 million bits of constraint. The network has 60 million parameters, each a 32-bit float. Nothing in the labels forces those parameters to encode anything general; there is ample room to store a lookup table of the training set.

Run the experiment without dropout. Training error keeps falling, because the fully connected layers are large enough to fit the training images individually. Validation error falls for a while, then flattens and begins to rise as the network starts fitting the noise particular to each training photograph. The paper does not give the curve, only that overfitting without dropout was substantial. The usual response at the time would have been to make the network smaller, which also throws away the capacity that made it accurate.

Dropout was the alternative. Halving the active units on each example acts like training a large family of thinner networks that share weights and averaging them at test time. The price was time: the authors note that dropout roughly doubled the number of iterations needed to converge. Data augmentation worked alongside it from the input side. The combination let them keep a network big enough to win.

The authors also report one ablation that settled an argument about depth. Removing any one of the middle convolutional layers raised top-1 error by about two points, even though each of those layers held only about one per cent of the parameters. The depth of the network, not its width alone, was doing work.

What later work changed

Almost every specific choice in AlexNet was revised within three years, which is a fair measure of how much of the paper was engineering under constraint rather than principle. Zeiler and Fergus (2013) visualised what each layer responded to and found the 11×11, stride-4 first layer was too coarse; a 7×7 filter with stride 2 did better. The VGG networks (2014) used only 3×3 filters, stacked: two 3×3 layers cover the same 5×5 area as one 5×5 filter with 18 weights per channel pair instead of 25, plus an extra non-linearity. VGG also reported that local response normalisation did not help, and it disappeared.

Batch normalisation (2015) made deep networks far easier to train and reduced the need for dropout. GoogLeNet and later designs replaced the giant fully connected layers with global average pooling, which removed most of the parameters the table above counts. ResNet (2015) added skip connections that let networks reach 152 layers, and its ImageNet top-5 error was 3.6 per cent. The two-GPU split survived in an unexpected form: grouped convolutions, where each filter sees only a subset of input channels, became a deliberate design tool in ResNeXt and the mobile networks.

The idea that lasted longest came from the paper’s Figure 4. The authors took the 4,096 numbers in the last hidden layer as a description of an image and showed that images with nearby vectors looked semantically alike, even when their pixels did not. Within a year, other groups showed that those features, lifted out of a network trained on ImageNet, beat hand-designed features on unrelated vision tasks. Pretrain on a large labelled set, then reuse the representation elsewhere: that pattern carried into language as well.

When this design is the wrong starting point

Nobody should build an AlexNet in 2026 except to learn from it. For a new vision task with a few thousand labelled images, the sensible start is a pretrained network (a ResNet, EfficientNet or Vision Transformer) fine-tuned on your data; training from scratch repeats the overfitting problem above with far less data than ImageNet. On a phone or a microcontroller, its 60 million parameters and ten-crop testing are the wrong trade, and architectures built for efficiency do much better per operation. With very large datasets, Transformers applied to image patches now match or beat convolutional networks. What the paper still teaches is the reasoning: find where the parameters and the arithmetic sit, and aim each fix at the part that is failing.

How to read the original

The paper is nine pages and readable in an evening. Start with Section 3, the architecture, which is ordered by the authors’ own estimate of importance: ReLU first, then the multi-GPU split, then normalisation and pooling. Section 3.5 and Figure 2 give the overall layout; Figure 2 is famously cropped at the top, and the stated 224-pixel input does not quite produce the 55×55 first-layer output (227 does), so do not lose time reconciling it. Read Section 4 on overfitting in full; it is where the 10-bits argument and the augmentation details live.

Skim the local response normalisation formula in Section 3.3; it no longer matters. In Section 6, look for the difference between the single-network result and the ensemble: the 15.3 per cent winning figure averaged seven networks, two of them pretrained on a larger ImageNet release, while one network alone was around 18 per cent on validation. That is still far ahead of the runner-up, but it is worth knowing what was compared. Then spend time on Figures 3 and 4, the learned filters and the nearest-neighbour images, which make the case for learned features better than any table.

AlexNet showed that a network could learn what to look for in pixels, given enough examples and arithmetic. Words have no pixels. The next paper, word2vec, asks what the equivalent of a learned edge detector is for vocabulary, and answers it with a model that is deliberately much simpler than this one.