Skip to the episode
The Intelligence Industry Ongoing series
Poster for the chapter: on the left, a large postal sorting room in 1951; on the right, an old hand-addressed envelope; bottom left, the chapter title and a sentence from the text.
On the left, a large postal sorting room, in 1951: not the Buffalo centre the text speaks of, but a sorting room shown for illustration. On the right, a hand-addressed envelope, stamped and postmarked: a nineteenth-century envelope, held by the Library of Congress. Charles Poalillo, Los Angeles Daily News, Mail sorting,1951, 1 December 1951. CC BY 4.0. Source: Wikimedia Commons. Gladstone Collection of African American Photographs, Stamped envelope addressed to Lieut Edwin T. Carrington LCCN2010652109, 1861. Public domain. Source: Wikimedia Commons. Composition, cropping and grading by Shy Robotics, under CC BY 4.0.
https://shyrobotics.com/wp-content/uploads/2026/12/Industrie-de-lIntelligence-E6-EN-NORM.mp3

The goal fits in one sentence: teach a machine to read the digits of a handwritten ZIP code, so that the mail sorts itself towards its destination. On an envelope, everyone draws their 4s and 7s in their own way, more or less slanted, more or less large, never quite in the same place. No hand-written rule covers all these variants: you need a network that learns to recognise a digit from examples, like the one in episode 5, but fed with images.

The quiet triumph promised by episode 5 took place on envelopes. Here it is. To get there, a practical problem had to be solved first: the size of the network. An image of 100 pixels by 100 makes 10,000 inputs. A first layer just as wide, ten thousand neurons each connected to the ten thousand inputs, would need 10,000 times 10,000, that is a hundred million weights, the numbers that learning adjusts one by one for each connection. That was beyond the reach of the data and the machines of the time.

A stencil moved across the image

The answer came first from Japan, with Kunihiko Fukushima’s Neocognitron, published in Biological Cybernetics in 1980, then took its modern form at Bell Labs in the hands of Yann LeCun. In 1989, he applied backpropagation to reading handwritten ZIP codes: the method that sends the error back from the network’s output to each of its weights, to tell each one by how much it should move.

Yann LeCun, photographed at the École polytechnique in 2018, twenty-nine years after the ZIP code network, for want of a free photograph from the time. Jérémy Barande, Yann LeCun, 25 June 2018. CC BY-SA 2.0. Source: Wikimedia Commons

The principle is called convolution: instead of connecting everything to everything, you slide a stencil a few pixels wide across the image, a small square of weights that specialists call a filter, reusing the same weights at every position. A network does not have just one, but several, often dozens, and each looks for its own shape: a vertical edge, a slanting stroke, a corner, a curve. Wherever that shape sits in the image does not matter: a slanting stroke is still a slanting stroke at the top left as at the bottom right, and the same stencil finds it everywhere.

Four stencils of five cells by five. The 1s draw the shape each one looks for; below, a piece of image where it responds most strongly, because its lit pixels fall exactly under those 1s. These shapes are examples: a network learns its own.

How does a stencil fit into a neural network? It is nothing other than a neuron, the one from episode 3, plugged into just a few neighbouring pixels: nine for a stencil of three cells by three. Its weights are the cells of the stencil, and its weighted sum is the stencil’s response at that spot. Convolution copies this same neuron to every position in the image, with exactly the same weights. The responses of all these copies, each placed where its piece of image sits, form what we will call further on the response map: a whole row of neurons that costs only the weights of a single stencil. A network has as many of these rows as it has stencils.

The stencil seen as a neuron. The nine pixels of a piece of image enter the neuron, which multiplies them by its nine weights, those of the stencil, and adds them up. A copy of the same neuron, with the same weights, looks at another piece. Each of the 36 copies, one per stencil position, writes its response into its own cell: the full map reads 2, 3, 3, 3, 3, 2 on the diagonal, 0 elsewhere.

The full map is not an addition of all these responses. Each copy of the neuron makes its own sum, over its own nine pixels, and writes the result into a single cell, the one that matches its position. Nothing passes from one cell to another. On an image of eight pixels by eight, the three-by-three stencil fits in six positions per row and six per column: thirty-six copies of the same neuron, thirty-six numbers, a map of six cells by six. Read at a glance, it redraws the stroke: 3 where the stencil sits squarely on it, 2 at the two ends, where it covers only part of it, 0 everywhere else. It is this drawing, and not a single number, that the layer passes on to the rest of the network.

The path of a single copy of the neuron: the nine pixels of its area each enter through a wire, each is multiplied by the matching stencil weight, the neuron adds up the nine products, and the total, 2, is written into the one cell of the map that matches this area.

Four clarifications avoid misreading this mechanism. First, the size of a stencil is fixed: all those in the same layer have the same, three cells by three here, five by five in LeCun’s 1989 network. It does not adapt to the handwriting: a 4 drawn small or large passes under the same stencil, which finds the same fragment in it, a piece of slanting stroke.

The same three-by-three stencil, laid on three 4s of different sizes: it does not grow with the digit, it finds the same fragment in each, a piece of slant, and responds 3 all three times.

Next, the areas looked at by two neighbouring cells of the map overlap. The stencil moves in small steps, always shorter than its own width: one pixel at a time in our examples, two pixels in LeCun’s 1989 network, with its five-cell stencil. Two neighbouring positions therefore share some of their pixels, six out of nine here. That is what stops a stroke from falling between two areas: if the stencil jumped three pixels at a time, a stroke straddling two areas would be seen only in part by each, and no response would reach 3.

On the left, the stencil moves one pixel at a time: two neighbouring positions share six pixels out of nine, and one of them lands right on the stroke, response 3. On the right, if it jumped three pixels at a time, the stroke would be split between two areas and neither would respond 3.

Third, a layer does not have a single stencil, but several, each tuned to a different shape: one to slanting strokes, another to horizontal bars, another to vertical strokes. Each slides over the whole image and produces its own map, which answers a single question: where is my shape? A layer of ten stencils thus produces ten maps, one per shape sought. They are not added together, because the sum would erase the answer: on a handwritten 4, with these three stencils, a point on the slant, a point on the bar and a point on the foot all give a total of 5, and the machine could no longer tell which is which. The maps therefore stay separate, and it is by reading them together, spot by spot, that you know which shapes are where.

Three stencils, three maps, each answering a single question. Read together, they say that at A there is a slant, at B a bar, at C a foot; added together, they would give 5 at all three spots, and you could no longer tell which is which.

Finally, the next layer no longer looks at pixels, but at these maps: its own stencils, still three cells by three, read at each spot the responses of all the maps at once, and so combine the fragments found by the first layer, a slanting stroke that meets a bar, a bar that crosses a foot. Each level sees a wider area of the original image, five pixels across at the second, seven at the third, and much more when the pooling described further on shrinks the maps between two levels, until it covers the whole digit. That is how a small stencil of fixed size is enough to read very different handwriting: the fragments look alike from one hand to another, and it is their assembly, level after level, that makes the digit. As for the size of the digits themselves, LeCun had help upstream: as we will see, each digit reached him already cut out and brought to the same format.

A chain of two layers. Layer 1 produces two maps, one per stencil. Layer 2 reads them like an image: its stencil has weights for each map, taken at the same spot, and its neuron responds 12 where a slant meets a bar. The map is not a neuron: it is the table of a layer’s responses, which the next level reads in turn.
The same stencil size, three cells by three, at every level; what grows is the area of the image a neuron sees: 3 pixels across at the first layer, 5 at the second, and the whole digit at the third when two-by-two poolings are inserted between the levels.

Who decides the shape of each stencil? Nobody. Its weights are parameters like any others, the values that training adjusts: drawn at random at the start, then corrected by the learning loop of episode 5, example after example, until each stencil specialises in the shape that most helps the network recognise digits. In the examples that follow, we choose the stencils by hand, to see the calculation; a real network finds its own.

Do it once, by hand. Start by looking at the image the way the machine receives it: not a drawing, but a table of numbers. Take an image of seven pixels by seven: each lit pixel is worth 1, each unlit pixel is worth 0. The slanting stroke is nothing more than a diagonal of 1s among the 0s.

The same slanting stroke, as you see it and as the machine receives it: a 1 for each lit pixel, a 0 for each unlit pixel.

Then take a stencil of three cells by three. It too is just a small table of numbers, its weights: the three cells on its diagonal are worth 1, the other six 0. Lay it on the image, straddling the stroke: it covers nine pixels. Multiply each pixel by the stencil cell lying just above it: a lit pixel under a 1 gives 1; an unlit pixel gives 0, whatever cell covers it. Add up the nine products: 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 = 3. This is the calculation of the neuron from episode 3, a weighted sum, here over nine inputs. This 3 is the stencil’s response at that spot: the three pixels of the stroke fall exactly under its three 1s.

The stencil laid across the stroke. Each pixel is multiplied by the stencil cell covering it; the stroke’s three 1s fall under the stencil’s three 1s, and the sum is 3. The stencil values are examples.

Now lay it on a shape that only partly resembles it: a stroke that sets off at a slant, then bends to run straight down. The first two lit pixels fall under 1s in the stencil: 1 × 1 = 1, they count. The third falls under a 0: 1 × 0 = 0, it does not count. The sum is 2, less than the 3 of the perfectly aligned stroke: the more the shape resembles the stencil, the stronger its response. Finally, shift the stencil one cell to the side of the slanting stroke: its two lit pixels both fall under 0s, and the sum drops to 0, as on an empty corner of the image.

The same stencil on two shapes that do not quite resemble it. Each lit pixel lying under a 1 of the stencil adds 1; each lit pixel lying under a 0 adds nothing. The response therefore measures how much the shape resembles the stencil: 3 for the aligned stroke, 2 for the bent stroke, 0 for the shifted stroke.

All that remains is to repeat the move everywhere. Shift the stencil one cell to the right, redo the nine multiplications and the addition, note the result; when you reach the edge, go down a row and start again from the left, the way you read a page. Each sum is written into a new grid, in the place the stencil occupied: this grid is called the response map. On our image, it fills with 0s, except for its diagonal, which reads 2, 3, 3, 3, 2: the map lights up exactly where the slanting stroke passes.

Each sum is written into the response map, in the place the stencil occupied: the position framed in red in the image gives the 3 framed in the map. At the two ends of the stroke, the stencil covers only two lit pixels, hence the 2s. The map has two cells fewer than the image, in width as in height, because the stencil has to fit inside it entirely.

On a real image, the point of the method becomes clear at once. Take a 4 written by hand, as it might appear in a ZIP code: a rising slanting stroke, a horizontal bar, a vertical foot. Slide four stencils over it, each with its three 1s arranged differently: on a rising diagonal, horizontally, vertically, on a falling diagonal. Each produces its own response map, and each map only really lights up, with 3s, where the stroke with its shape passes: the rising diagonal finds the 4’s slanting stroke, the horizontal its bar, the vertical its foot. The falling diagonal finds three pixels aligned in its direction nowhere: its map never goes above 2. The digit ends up broken down into strokes, and each stroke located at the exact spot where it lies. A layer of stencils therefore does not recognise the 4 in one go: it draws up an inventory of its strokes and their position, and it is the following layers that make use of it. Had the 4 been written higher up or further to the right, the same stencils would have found the same strokes; the maps would simply have lit up elsewhere.

The same 4 passed under four stencils. Each response map lights up in bright yellow, with 3s, where the stroke has the stencil’s shape: the slanting stroke for the rising diagonal, the bar for the horizontal, the foot for the vertical. The falling diagonal finds three pixels aligned in its direction nowhere. The stencils are examples; a real network learns its own.

The stencils of real networks do not carry only 0s and 1s. Their weights can be negative: a negative weight subtracts the pixel it covers instead of adding it. The most common of all, the vertical edge stencil, carries −1, −2, −1 in its left column, nothing in the middle, +1, +2, +1 in its right column. On a uniform area, all white or all black, the pluses and minuses cancel out, and the response is zero. At the left edge of a vertical stroke, the right column covers ink and the left column paper: the response is strong. At the right edge, it is the other way round: the response is just as strong, but negative, and its sign says on which side the ink lies.

The vertical edge stencil laid on four areas. Each pixel is multiplied by the weight covering it, then the products are added. On white as on black, the response is zero; it is strong only at the edge of the stroke, positive at the left edge, negative at the right edge.

Turned a quarter turn, the same stencil finds horizontal edges; turned an eighth, slanting edges. These edge detectors bear the name of Irwin Sobel, who presented them with Gary Feldman in 1968 at the Stanford Artificial Intelligence Laboratory; image processing used them long before neural networks.

The same stencil, turned an eighth of a turn and then another: its weights move one cell round the centre, and it goes from the vertical edge to the slanting edge, then to the horizontal edge. Each responds +4 to the area that carries its edge.
The same digits passed under four edge-detecting stencils, of the kind Sobel described. The vertical edge lights up the vertical strokes of the 1 and the 4, the horizontal edge the bars of the 4 and the 2, the rising slanting edge the slanting strokes of the 4 and the 2. Only positive responses are drawn; negative ones are brought back to 0, as by the threshold of episode 3. The digits are drawn for the example.

The most striking thing lies elsewhere: when a network is left to learn its own stencils, those of its first layer usually end up looking like them. In 2012, Alex Krizhevsky, Ilya Sutskever and Geoffrey Hinton observed that the first layer of their network had learnt, on its own, stencils sensitive to orientation, detectors of edges and strokes in every direction, alongside blobs of colour.

With each weight replaced by a colour, the stencil becomes a small image: one band against another, in a given direction. That is how the stencils learnt by a network are looked at; those of the first layer of Krizhevsky, Sutskever and Hinton’s network, in 2012, show such bands oriented in every direction.

This weight sharing, the reuse of the same weights at every position, is already there in Fukushima, where each plane of cells repeats the same distribution of synapses from one end of the image to the other; what LeCun brings to it is backpropagation.

Sliding one stencil over the whole image brings two things. First, there are far fewer weights to adjust: on an image of a hundred pixels by a hundred, the nine weights of a stencil replace a hundred million connections, and that gain is certain. Second, a stroke is spotted wherever it lies, since the same stencil passes everywhere; this second gain is less complete than it looks, and the rest of the episode will say why. The result was not long in coming.

The grid and the column on the left show only a sample. Both counts apply to a single layer; a real convolutional network stacks several, each with its own stencils.

Since the same weights are reused everywhere, a shape that moves produces the same response. The response follows the movement; it does not stay put. The network therefore never has to learn separately the slanting stroke in the top corner and the one in the bottom corner.

That is the whole point of these identical neurons, laid like a grid over the entire image: the network does not learn to recognise a stroke at a given spot, it learns a stroke, once, and the grid looks for it everywhere on its behalf.

The same 4 written in three places, passed under the same stencil. The three maps carry exactly the same responses, simply moved with the digit: the stroke is spotted wherever it lies, without the network having learnt it three times.

Orientation, on the other hand, is not part of the package. Rotating an image and then passing it under the stencil does not give the same result as passing the stencil and then rotating. Specialists say that a classic convolutional network is equivariant only to translation: its response moves with the shape when you slide it, not when you rotate it. An object shown at an angle it has never met can escape it completely.

This stencil knows only the falling diagonal. On the rotated stroke, it never finds more than one lit cell out of three.

So what do people do? The most down-to-earth thing imaginable, and that admission says a lot about the field: they show the network the same images rotated every which way, until it learns to recognise them. This is data augmentation, a universal and yet approximate practice, which costs training time and guarantees nothing outside the angles shown. It is the first move of what we will later call the data factory, the one where nothing new is collected, where what we already have is transformed.

The angles are examples. The network will only recognise the rotations it has been shown; a seven turned by 90 degrees would remain foreign to it.

Architectures have indeed been designed to build rotation into the structure itself, such as the group equivariant networks proposed by Taco Cohen and Max Welling in 2016, but they remain a minority. What the architecture offers is solid and free; what has to be learnt through examples is fragile and expensive. The whole story that follows plays out along this border.

You often hear that a convolutional network does not care where a shape is. That is not what we have just seen: when the 4 moves, its response moves with it on the map. The stencil therefore says where the shape is. Yet the question put to the network is not “where is the 4?”, but “is this a 4?”: a 4 written a little higher or a little further to the right is still a 4, and the verdict must not change for so little. Position still matters inside the digit, though: it is because the slant sits above the bar, and the foot on the right, that a 4 is a 4. So the small movements of the whole digit have to be forgotten, without forgetting how the strokes are arranged relative to one another. That is the job of a second mechanism, distinct from the stencil: pooling. After each stage of stencils, the response map is cut into small squares of two cells by two, laid side by side without overlapping, and the four values in each square are replaced by a single one, most often the strongest. The map thus loses half its rows and half its columns. It keeps the response, but no longer its exact place: the network knows that something lit up in the square, without knowing in which of the four corners. A shift of one cell inside the square therefore no longer changes anything.

Repeat the operation over several stages, and a shift of a few pixels ends up changing nothing at the output: the response no longer follows, it stays put. That is where indifference to position is born, and not in weight sharing. LeCun and his co-authors put it in black and white in 1998: invariance to distortions is obtained through this progressive reduction in resolution, offset by a progressive enrichment of the representation. Two organs, then, and two distinct services: the stencil makes the response follow and brings the bill down, pooling makes the network forget where it lit up. This distinction becomes decisive as soon as a robot arm has to be controlled.

Each square of four cells becomes one cell; the map goes from 36 cells to 9. What pooling erases is the exact place of the response inside its square, not its presence.

Put end to end, stencils and poolings form a chain, and it is the chain that reads the digit. The first layer finds strokes; the second, junctions between those strokes; pooling tightens the maps; the third layer recognises an assembly of junctions, and a final neuron gives the verdict. At each stage, the area of the image a neuron sees grows, from three pixels across to the whole digit.

A complete chain, calculated on the handwritten 4 with stencils chosen by hand: three stroke maps, two junction maps, a pooling of two cells by two, an assembly map, then the verdict neuron. At each stage, only complete responses stay lit. Applied to a 7 or a 1, the same chain finds neither junction nor crossing, and the “4” neuron stays dark. A real network finds its stencils on its own, and uses many more of them.

Your turn to move a digit around. The third tab below runs a small stencil network, trained only on digits placed in the centre of a blank sheet. Slide the digit: the stencils’ maps follow it, and since the network keeps only the strongest response of each map at the end, its verdict does not budge. Then rotate it a quarter turn: that is where it loses its grip.

Backpropagation, step by step

Three tabs. The first plays backpropagation on a small network, the second shows it at work on a real one, the third moves a digit under a stencil network, the kind this episode is about.

Blue: what moves forward. Red: the blame travelling back, thicker when a weight is more to blame. Yellow: what to look at.

➡️ the numbers move forward, from input to output

The four cases

average loss per epoch

Model, source and limits

Model: the loss is half the square of the gap; a neuron’s blame is the sum of the blames it feeds, each multiplied by the weight; a weight’s slope is the blame where it arrives multiplied by what it carried; the correction is the learning rate multiplied by the slope. Source: the paper by Rumelhart, Hinton and Williams (Nature, 1986), and the numbers in this episode. Limits: a small dense network; real networks have millions of weights, and the On a real network tab only recognises single digits, drawn as in MNIST.

784 inputs, 32 hidden neurons, 10 outputs: 25,450 parameters set by the same backpropagation, on 60,000 handwritten digits. Data: the MNIST database (Yann LeCun, Corinna Cortes, Christopher Burges).

Tab 3: a stencil network with 6,346 weights. Eight 5 × 5 stencils, 2 × 2 pooling, sixteen 3 × 3 stencils, pooling, thirty-two 3 × 3 stencils, the maximum of each map, ten outputs. It was trained offline by backpropagation, with a cross-entropy loss and the Adam method, which sets the step size weight by weight, on the 60,000 MNIST digits set in the middle of a blank sheet. It reads the field surrounded by the same blank margin. The ten examples are, for each digit, the first test image it recognises in the middle of the field.

Without script: in the example from the text, the dog output is 0.70 when 0 was expected. The weight 0.80 carried 0.60: its slope is 0.70 × 0.60 = 0.42, and at a learning rate of 0.1 it becomes 0.758. The hidden neuron receives a blame of 0.56 from dog and −0.14 from cat, 0.42 in all.

Along the way, the stencil settles the question of size, but only halfway. A stencil travels: give it an image twice as large, and it will travel twice as long and produce a response map twice as large. Convolution layers therefore do not care about dimensions. But the verdict, at the end of the network, is given by fully connected layers, where each input is connected to each output, with no stencil and no sharing, as in the network of episode 2. Those layers demand a number of inputs fixed in advance, and bring the constraint back. Hence the practice of a whole decade: resizing and cropping images to a single format, two hundred and twenty-four pixels across for the most widespread architectures.

Kaiming He and his co-authors proposed doing away with it in 2014, with a sentence from their paper that I like because it says what many thought without writing it: this requirement is artificial. Their solution is to insert, before the fixed part, a pooling operation whose cells are proportional to the image rather than of constant size. Large image, large cells; small image, small cells; and in both cases the same number of values at the output. The network now accepts any size without the photograph being mutilated to make it fit.

The fixed part, where each input is connected to each output, expects exactly 9 values. A small image supplies them. A large image supplies 36 with fixed-size pooling cells: before 2014, it had to be cropped or shrunk, even if that cut off the foot of the 4. With cells proportional to the map, the large image also gives 9 values. The 2014 method stacks several cuts of this kind, finer and finer, and puts the values obtained end to end.

A word on colours, since they raised the same question. A colour image is three grids stacked on top of one another, one per primary colour. The stencil does not look at just one: it has three layers of its own and reads all three at once, which lets it detect patterns that exist only in colour, a border between red and green for example, invisible in greyscale. These stacked layers are called channels, and nothing requires them to be colours. A robot fitted with a depth camera, such as the Kinect, adds to the three colours a fourth channel that gives, for each pixel, the distance of the object; an observation satellite such as Sentinel-2 supplies thirteen, one per band of light, several of them invisible to the eye; a thermal camera has only one, temperature. And inside the network, the maps produced by a layer’s stencils become the channels of the next layer: the map of slants, the map of bars, the map of vertical strokes, stacked like the three colours of a photograph. The following layers pile up dozens of them, then hundreds, each devoted to a different pattern.

A 3 × 3 stencil on a colour image therefore carries 27 weights, not 9. In the deep layers, each channel is no longer a colour but the response map of a stencil from the previous layer.

The first success fitted on envelopes, and it did not read addresses

The US Postal Service had entrusted LeCun with 9,298 handwritten digits, cut out of ZIP codes taken from the mail passing through the Buffalo post office, 7,291 of them for training. His network recognises exactly 95% of the test set, and the method would soon move from envelopes to bank cheques. Only nine thousand seven hundred and sixty parameters, for sixty-four thousand six hundred and sixty connections, so much does weight sharing save. That was what the lock backpropagation had just broken was worth, in practice.

Do the sums. The test set gathers the 9,298 digits minus the 7,291 used for training, that is 2,007 digits the network had never seen; 5% errors means about a hundred digits misread. And 64,660 connections for 9,760 parameters: each parameter is used 6.6 times on average, at different places in the image.

The lengths are to scale. The 2,007 test digits had never been shown to the network during training: the 95% is measured on them alone.
Thirty years before LeCun, mail sorting was already a matter of machines: the five-destination sorter by Rabinow Engineering, delivered to the US Post Office in August 1958. This is not the line the networks won, it is the one they found when they arrived. National Institute of Standards and Technology, RabinowJacob 013, August 1958. Public domain. Source: Wikimedia Commons

Yet this network did not read an address. It received digits already separated: the 1989 paper specifies that each image given to the network contains only one digit, brought to a standard format. Everything before that had been done before the image reached it: finding the address on the envelope, spotting the ZIP code line in it, then cutting that line into five small images, one per digit. The network came in only at the very last step, the one that consists of saying, in front of an image containing a single digit, which digit it is. It is the most spectacular step, but not the hardest: recognising a single character is much simpler than reading a string of characters that touch, where you first have to know where one ends and the next begins.

Before 1998, each step was tuned on its own test bench. Yet a step that excelled on its own measure could hinder the next one: nothing measured the reading as a whole.

This cutting up is called segmentation, and the problem it poses is remarkably perverse, the kind that goes round in circles. To recognise a digit, you first have to isolate it. But to know where to cut, in handwriting where characters touch, tangle and overlap, you would already need to know what they are. Cutting assumes recognising, recognising assumes cutting. Every attempt that treated the two steps separately stumbled on the same thing: one unlucky cut, and the best classifier in the world conscientiously recognises halves of digits.

The green cut gives two whole digits, the red one a truncated 3 and a piece of 5. Nothing in the image alone says which one is right.

To break out of this circle, LeCun published a paper in 1998 with Léon Bottou, Yoshua Bengio and Patrick Haffner, Gradient-Based Learning Applied to Document Recognition. Their solution is to refuse to choose. Rather than deciding where to cut, you cut generously, at every vaguely plausible place, which produces a thicket of competing hypotheses. The network gives each one a score. And on top, a language model decides, that is, a program that knows which sequences of symbols are possible: in a US ZIP code, some sequences of five digits exist and others do not; on a cheque, an amount obeys writing rules that rule out many sequences of signs. It is the reading of the whole that decides the cutting, and not the other way round.

The scores are examples. What wins is not the best score, but the best score compatible with what a ZIP code can be.

The authors go further: they make the entire chain differentiable, from extracting the field to the language model. Differentiable means that you know how to calculate, for each parameter of each module, the slope of the final error, the gradient of episode 5. All the modules are then trained together on a single measure of performance, the accuracy of the final reading.

This move ranks among the most important in machine learning: end-to-end training. You stop optimising each step for its own sake, you optimise the result that matters, and you let the chain share out the work, on one condition: that the error can travel back up every step, from one end to the other, which requires each of them to be differentiable. The system described in that paper read, according to its abstract, several million cheques a day in the United States; the body of the paper, for its part, speaks of several million a month. And you will find this principle everywhere afterwards, right up to language models: do not split the problem into tasks you judge simpler, give the whole task to the machine and let backpropagation decide who does what.

This is the backpropagation of episode 5, applied no longer to the layers of a network but to the steps of a chain: the final reading error shares out the blame among the modules.

What an arm must remember, and what reading was better off forgetting

This move eventually left paper and entered an arm. In 2015, Sergey Levine, Chelsea Finn, Trevor Darrell and Pieter Abbeel put the question to a robot: is it better to train perception and control together, or each on its own? Their answer fits in a convolutional network of ninety-two thousand parameters and seven layers, which runs from the camera image to the torques sent to the motors of a PR2, that is, the turning forces commanded at each joint, with no intermediate step written by hand. The robot screws a cap onto a bottle, slides the claw of a hammer under a nail, hangs a coat hanger on a rail.

The Berkeley team’s PR2, nicknamed BRETT, learns to hang a coat hanger on a rail and to screw on a cap; the video also shows other tasks learnt by the same team. Video: UC Berkeley.

This network works without any pooling, and that is deliberate. LeCun wanted to know which digit was written, no matter where; an arm that has to grasp a cap needs to know where it is, to the pixel. The authors write it: in classification, pooling throws away position information, whereas for controlling a robot that is what counts. Their network therefore makes do with three layers of stencils, which keep their maps at full size, thirty-two maps of 109 cells by 109 at the last layer. It follows them with an operation of a different nature. Each map is reduced not to its strongest response, as pooling would do, but to the place where it lights up: the centre of its response area, a point in the image given by two coordinates. A map that has learnt to respond to the cap becomes “the cap is here”, another “the edge of the bottle is there”. This operation also fills pooling’s other role, which is to tighten: thirty-two maps become sixty-four numbers. These coordinates are joined to the current position of the arm’s joints, and two small layers of forty neurons draw from them the forces to send to the seven motors. What reading characters was better off forgetting, controlling a robot must keep: the network no longer asks what is in the image, but where the things that matter for its movement are.

Two maps from the same layer, the cap on the left then on the right. Reduced to its strongest response, as pooling pushed all the way would do, each map gives 5: the value says the cap is seen, not where. Reduced to the centre of its response area, as in the Berkeley network, it gives two coordinates, x = 3 and y = 4, then x = 7 and y = 6: the place of the cap, the one the arm must reach.
The coordinates are examples. The same start of the network serves both uses; only the end differs, depending on whether position must be forgotten or kept.
A Willow Garage PR2, the robot model on which Levine and his co-authors ran the camera all the way to the motors with no intermediate step. Willow Garage, PR2 Tabletop, 4 November 2009. CC BY-SA 3.0. Source: Wikimedia Commons

Object detection went through the same story as reading the mail. Counting the cars in a photograph poses the same problem as reading a ZIP code: to know how many there are, you first have to locate them one by one, and so cut the image into distinct objects, even though they partly hide behind one another. For a long time, this was done in several separately tuned steps: a first step pointed to the areas of the image where an object might be, then a classifier examined each area to say what it contained. And as with the mail, the solution was to merge these steps into a single network, trained end to end on the result wanted.

In June 2015, Joseph Redmon and his co-authors published a system with a name that says it all, “you only look once”, which they presented the following year at the CVPR conference (Computer Vision and Pattern Recognition), the field’s great annual gathering. It stops recycling a classifier moved across the image and frames detection as a single prediction: one network produces in one go, for the whole image, the rectangles where the objects are and what they are. Forty-five images per second, enough to process a video as it streams. Always the same move: several steps cobbled together by hand become a single network trained on what you really want to obtain.

How does a network, which only knows how to produce numbers, indicate a location? By producing numbers, precisely. The image is cut into a grid of cells, and each cell is asked to answer three questions at once: is there something here, if so of what size and centred exactly where, and what category is it. The coordinates of the rectangle become outputs like any others, on the same footing as the probability of being a dog.

Count them. The 2016 grid is seven cells by seven. Each cell proposes two rectangles, of five numbers each (the centre, as two coordinates, the width, the height and the confidence), then twenty probabilities, one per category: two times five plus twenty, thirty numbers. Seven times seven times thirty: 1,470 numbers for the whole image, in a single pass. Position was never a problem of a different nature: it was a problem of extra outputs. Every time you see a network accomplish a task that seems beyond its reach, look first for how someone managed to restate it as numbers to predict.

The figures are those of the 2016 version, trained on twenty categories of objects. An object’s rectangle is predicted by the cell where its centre falls.

The same skill brought down the test that told us apart from machines

Reading distorted characters is also a test we all take, several times a month, without thinking about it. To stop automated programs from creating accounts in bulk or snapping up concert tickets, websites have since the early 2000s asked us to copy out a word that a machine itself made up, then damaged. The site draws a random string of letters and digits, twists the characters and squeezes them until they touch, strikes them through with a line, then drowns them in stray dots. It keeps the right answer to itself and compares: if what you type matches, you pass.

The site makes the test itself and keeps its answer. The distortions target what a machine did badly: characters that touch cannot be cut apart, and twisted, struck-through, noisy shapes no longer look like the models a program knows how to recognise.

The test is called a CAPTCHA, the English acronym for a “Completely Automated Public Turing test to tell Computers and Humans Apart”, developed in 2000 by a team at Carnegie Mellon University led by Manuel Blum. The Turing test, devised in 1950, puts a human judge in written conversation with interlocutors he cannot see, and asks him to guess which one is a machine; the CAPTCHA reverses it, since it is a machine that asks the question and must recognise the human. The distortions are not chosen at random: they target what the machines of the time did badly. A human reads the word at a glance; recognition software cut in the wrong place and recognised pieces of letters. The entire security of sign-ups, ticket offices and forms thus rested on a conviction: reading distorted characters would stay beyond the reach of machines.

It fell in April 2014. A Google team, led by one Ian Goodfellow, of whom you will hear again, was trying to read house numbers on Street View photographs. The problem is the one we have just described: find the number, cut it up, recognise it. Their answer is that of 1998, taken all the way: a single network that locates, segments and recognises in one move, with no separate steps.

They posted this work in December 2013, and it is only about house numbers. Then, to check that their method works for other texts, they put their network up against reCAPTCHA, Google’s CAPTCHA service. It deciphers the hardest category with 99.8% success. That result is absent from the December posting, which does not contain the word CAPTCHA a single time and did not even carry the title under which the paper is cited today; it appears in the version posted on 14 April 2014. The authors conclude there, soberly, that the usefulness of distorted text as a test of humanity is greatly diminished. Google acknowledged it publicly nearly eight months later, on 3 December 2014, when it announced the tick-box CAPTCHA: distorted text, on its own, is no longer a reliable test. The announcement is a company blog post, signed by the reCAPTCHA product manager, who is also one of the paper’s co-authors.

Take the measure of the shift. One of the most ordinary barriers between the automaton and the human had just given way, not under a hacker’s assault, but as a side effect of a mapping project. That is why, since December 2014, Google’s CAPTCHA no longer really asks you to read: it observes your whole interaction with the test, before, during and after. The question is no longer “can you read this”; it has become “do you behave like a human”. This arrangement is probably not final. The networks of 1989 and 1998 belong to history and will not change; the way a site tells a human from a program today will change again, as programs learn to imitate our gestures the way they learnt to read.

Between the December 2013 posting and the tick-box CAPTCHA, one year: the time it took for a mapping project to become a proof, then a product decision.

Before closing on that note, the other half of the story deserves its due, or it would be impossible to understand why the world rushed ahead. The CAPTCHA itself is the loveliest proof of it. One of its inventors, Luis von Ahn, published the calculation in Science in 2008: more than a hundred million CAPTCHAs are typed every day worldwide, which adds up to hundreds of thousands of human hours a day. The idea he draws from it, which I still find magnificent: rather than made-up words, show internet users the words that no recognition software managed to read in digitised archives. You proved you were human, and along the way you transcribed a line of an old newspaper.

The method fits in a few words. Each test showed two, in a random order: one whose answer was known, used to check the human, the other taken from an old page that the software had failed to read. On these prints with faded ink and yellowed paper, automatic recognition missed about one word in five. Whoever typed the first word correctly had their reading of the second counted as one vote; a software reading was worth only half a vote, and two and a half matching votes were needed to settle the spelling of the word. Do the sums on the time given: the authors measure thirteen seconds per CAPTCHA on average, and a hundred million CAPTCHAs a day come to more than three hundred thousand hours.

The known word is an example. The two words were shown in a random order, so that the internet user did not know which one served as the check.

The paper does not just propose the method, it measures it, and that is what makes it convincing: on a sample of New York Times articles drawn from 1860, 1865, 1908, 1935 and 1970, the crowd gets 99.1% of words right, on a par with the guarantee of more than 99% sold by professional transcription services. More than forty thousand sites were already using the system, for more than four hundred and forty million words transcribed. Google bought reCAPTCHA in September 2009 and plugged it into its own digitisation projects, Google Books and newspaper archives. The most hated chore on the web made searchable millions of pages that had been sleeping on yellowed paper.

A word the software failed to read is shown to several internet users. Each reading counts as one vote if the user passed the control word, the software’s as half a vote, and the word is settled at two and a half matching votes: a weighted sum and a threshold, as in an artificial neuron. The transcribed word and its image form exactly what a network needs to learn to read; that is how, through the votes of internet users paid by the task, ImageNet was labelled in 2009, the image database on which the great vision networks would be trained.

And the skill that brought down this test is exactly the one that today makes readable parish registers, handwritten censuses and letters that no one would have had the budget to copy out by hand. Automatic postal sorting did not only make money for operators: it made it possible to carry ever more mail without hiring as many people, and to lighten part of the sorting by hand. The same ability opens one door and breaks down another, and you can rarely have only the first.

And one observation that will serve you a few episodes from now. Reading an address is no longer classifying an image, it is producing a sequence: one decision after another, each depending on the previous ones, since the third digit of a ZIP code only makes sense with the first two. The problem has just changed its nature. Computer vision had just met, without knowing it, the difficulty that would occupy the next twenty years, right up to today’s language models: how does a machine handle a sequence?

The code is an example, in the form of the Buffalo codes, which all start with 142. In a US ZIP code, the first digit designates a group of states, the next two a sorting centre: each digit narrows down the ones before it.

The first undisputed industrial success of neural networks is there, in plain sight. It will not be enough to convince.

Sources

A stencil moved across the image

  • Neocognitron · Fukushima, Biological Cybernetics 36, 1980, received in October 1979 · peer-reviewed · weight sharing from one end of the image to the other
  • Backpropagation Applied to Handwritten Zip Code Recognition · LeCun et al., Neural Computation 1(4), 1989, pages 541 to 551 · peer-reviewed · the two-to-one reduction in resolution from one stage to the next, and its reason: detecting the presence of a stroke takes precision, locating it takes less; approximate position information must be kept so that later stages can assemble larger shapes
  • Gradient-Based Learning Applied to Document Recognition · LeCun, Bottou, Bengio and Haffner, Proceedings of the IEEE 86(11), November 1998, pages 2278 to 2324 · peer-reviewed · invariance to distortions obtained through the progressive reduction in resolution
  • Spatial Pyramid Pooling in Deep Convolutional Networks · He, Zhang, Ren and Sun, posted on 18 June 2014, published in Computer Vision – ECCV 2014 · the end of the imposed input format
  • Group Equivariant Convolutional Networks · Cohen and Welling, posted on 24 February 2016, presented at ICML the same year · peer-reviewed for the conference
  • Sobel operator · English Wikipedia · collaborative encyclopaedia · the operator presented by Irwin Sobel and Gary Feldman in 1968 at the Stanford Artificial Intelligence Laboratory, under the title “An Isotropic 3 × 3 Image Gradient Operator”; two 3-by-3 stencils, one per direction
  • ImageNet Classification with Deep Convolutional Neural Networks · Krizhevsky, Sutskever and Hinton, Advances in Neural Information Processing Systems 25, 2012 · peer-reviewed · the 96 stencils learnt by the first layer: “a variety of frequency- and orientation-selective kernels, as well as various colored blobs”

The first success fitted on envelopes, and it did not read addresses

  • Backpropagation Applied to Handwritten Zip Code Recognition · LeCun et al., Neural Computation 1(4), 1989, pages 541 to 551 · peer-reviewed · 9,298 digits cut out in Buffalo, 7,291 of them for training; 5.0% error on the test set; 9,760 free parameters for 64,660 connections; an input made of normalised images of isolated digits
  • Gradient-Based Learning Applied to Document Recognition · LeCun, Bottou, Bengio and Haffner, Proceedings of the IEEE 86(11), November 1998, pages 2278 to 2324 · peer-reviewed · LeNet-5, over-segmentation, the language model, training of the whole chain and the cheque-reading system deployed at NCR

What an arm must remember, and what reading was better off forgetting

  • End-to-End Training of Deep Visuomotor Policies · Levine, Finn, Darrell and Abbeel, April 2015, published in Journal of Machine Learning Research 17, 2016, pages 1 to 40 · peer-reviewed · from the camera to the motors of a PR2, without pooling, with the coordinates of salient points
  • You Only Look Once: Unified, Real-Time Object Detection · Redmon, Divvala, Girshick and Farhadi, posted on 8 June 2015, presented at CVPR 2016 (conference version) · peer-reviewed for the conference · forty-five images per second; a grid of 7 × 7 cells, two rectangles and twenty categories per cell, 7 × 7 × 30 numbers at the output

The same skill brought down the test that told us apart from machines

  • Multi-digit Number Recognition from Street View Imagery · Goodfellow, Bulatov, Ibarz, Arnoud and Shet · preprint never published in a journal · the first posting, of 20 December 2013, is titled Street Number Transcription with Deep Convolutional Neural Networks and does not mention CAPTCHA; the second version already carries the title above without mentioning CAPTCHA; the passage on reCAPTCHA and the 99.8% appear in the version posted on 14 April 2014
  • CAPTCHA: Using Hard AI Problems For Security · von Ahn, Blum, Hopper and Langford, paper at Eurocrypt 2003 · peer-reviewed for the conference · the authors write that they introduced the notion of CAPTCHA in 2000
  • reCAPTCHA: Human-Based Character Recognition via Web Security Measures · von Ahn, Maurer, McMillen, Abraham and Blum, Science 321, 12 September 2008, pages 1465 to 1468 · peer-reviewed · more than a hundred million CAPTCHAs typed a day and thirteen seconds per CAPTCHA on average; a control word and an unknown word, shown in a random order; two and a half votes to settle a word, half a vote for the software’s reading; about one word in five missed by automatic recognition on old prints; 99% of words correct on the New York Times sample, more than forty thousand sites and more than four hundred and forty million words transcribed
  • Teaching computers to read: Google acquires reCAPTCHA · official Google blog, 16 September 2009 · company announcement, co-signed by Luis von Ahn, both seller and author of the previous paper · the move to Google Books
  • Are you a robot? Introducing “No CAPTCHA reCAPTCHA” · Vinay Shet, Google Online Security Blog, 3 December 2014 · company announcement, signed by a product manager who is also a co-author of Goodfellow’s paper · distorted text, on its own, is no longer a reliable test; the same 99.8%
  • CAPTCHA · Encyclopædia Britannica · encyclopaedia · Manuel Blum’s team at Carnegie Mellon, in 2000, and the expansion of the acronym
  • ImageNet: A Large-Scale Hierarchical Image Database · Deng, Dong, Socher, Li, Li and Fei-Fei, CVPR 2009 · peer-reviewed for the conference · labelling through votes by internet users on Amazon Mechanical Turk, an image being kept only by a clear majority
  • Robot masters new skills through trial and error · University of California, Berkeley press release, May 2015 · institutional press release · BRETT, the team’s PR2, and its tasks
  • Sentinel-2 MSI, spectral resolutions · European Space Agency · official documentation · the thirteen spectral bands
  • Drilling Down on Depth Sensing and Deep Learning · Berkeley BAIR lab blog, 23 October 2018 · lab blog post · the Kinect, a camera that gives the distance of each pixel

LAISSER UN COMMENTAIRE

Turn on JavaScript to leave a comment.