Geoffrey Hinton: Dynamic Routing Between Capsules

On Capsule Networks: Why Viewpoint Matters

NeurIPS keynote, 2017
Video thumbnail: Geoffrey Hinton on Capsule Networks: Why Viewpoint Matters
55 minKeynote31K views across 3 uploads8,833-word transcriptWatch on YouTube ↗

What Hinton talks about

Geoffrey Hinton gave this keynote at NeurIPS in 2017, explaining capsule networks and how routing by agreement can preserve viewpoint and pose information in visual recognition.

Also known as: Capsule Networks; Geoffrey Hinton on Capsule Networks; NeurIPS keynote on capsule networks.

Hinton’s keynote lays out why standard convolutional networks struggle with viewpoint changes, novel orientations, and compositional structure in images. His core claim is that recognition should preserve pose information instead of pooling it away.

He introduces capsules as small groups of neurons that represent different properties of the same entity, including an object’s presence and pose. The key mechanism is routing by agreement: parts vote for wholes, and clusters of consistent votes reveal the object.

He also discusses the limits of unsupervised learning for this setup, the engineering challenges of scaling capsule systems, and early results on viewpoint extrapolation and overlapping-digit segmentation. The talk matters because it reframes vision as geometry plus agreement, not just invariance by pooling.

John gives the introduction; Hinton speaks throughout the keynote.

In his words

“The biggest source of variation in images is from changing viewpoints”
at 1:32
“The relationship between the mouth and the face does not change as you change your viewpoint”
“We should actually have something between a layer and a neuron”
at 16:06
“Agreement is crucial here”
at 21:51

Key points

  • Convnets are good at translation but weak on viewpoint, pose, and part-whole structure.
  • Changing viewpoint scrambles pixels, so the system should encode objects in coordinates rather than discard positional information.
  • Capsules package multiple neurons to represent an entity’s properties, including its pose relative to a frame of reference.
  • Recognition happens through routing by agreement: lower-level parts send votes to higher-level wholes, and consistent votes form clusters.
  • The invariant knowledge lives in the relationships between parts and wholes, not in the changing pose values themselves.
  • Unsupservised learning alone tends to collapse the votes; discriminative learning is needed to prevent degenerate solutions.
  • The approach showed improved generalization to unseen viewpoints and strong segmentation behavior on overlapping digits.

Full transcript: Geoffrey Hinton, Dynamic Routing Between Capsules (2017)

Thank you, John, for that nice introduction. Before I start, I'd like to say something about Ian Howard. I used to love to visit York and talk to Ian Howard. He was a really great scientist. He always struck me as the closest I'll ever get to meeting a true Victorian scientist, and he loved making things. So, your honored minds, move Ian. Okay, today I'm going to talk about some work that's already published on capsule networks. The current way to do object recognition is to use convolutional neural nets. They've got multiple layers of feature detectors which you learn discriminative

lists. That's good, and the features are local, and each type of feature detector is replicated across space so they can deal with objects when they move or when they're in, have a different position. That's good. As you go up the hierarchy of features, the feature detectors respond to things in a larger region of space, and that's good. The feature types are interleaved with subsampling layers, which pull the information from a bunch of feature detectors, and the aim of that is to get invariance and to throw away positional information, and that's bad. Um, I'll try and argue with you either

I'll tell you why that's bad. So current neural nets, they do object recognition—convolutional nets cannot generalize well to novel orientations or scales or shears, and they're not dealing in a principled way with the effect that a change of viewpoint has on an image. So the biggest source of variation in images is from changing viewpoints. There's other sources of variation like lighting and stuff like that, but changing viewpoints is a particularly nasty source of variation for machine learning, and I'll try and give you insight into why it's so nasty.

The same part of an object shows up on different pixels when you change your viewpoint. Okay, and for machine learning, that's as if you had two hospitals that coded their data differently. So in hospital one, you code the data as age, weight, blood type, financial status, and in hospital two, you code the data as weight, blood type, age, financial status. You have to get financial status in. Um, now if you knew that, if you knew that the same information was going to show on different input dimensions, you'd be crazy if you did machine learning to just go about doing learning by say, "Well, we're going to ignore that. We just need to get lots and lots of hospitals, and we're just going to hope it all sort of

averages out somehow." You'd obviously want to unscramble it so you get the same dimensions meaning the same things. But that's what viewpoint does to images: it puts the same information on different pixels. And the way convnets trying to deal with it is by just trying to get lots and lots of images from different viewpoints and gently unscrambling it by pooling. The best they've got for unscrambling is pooling, which says if it occurred nearby, it'll eventually lead to the activation in the same feature detector because we're pooling. That doesn't seem like a very principled way of dealing with viewpoint, and this whole talk is going to be about how we might deal better with viewpoint. The one good thing about it is it does deal with

translation. So in a complete convnet, because you replicate features across space, if I translate the image, there will be a feature detector of the same kind in a different position that will respond to whatever feature I saw before. That's not actually equivariance—sorry, that's not actually invariance; that's equivariance. In other words, when I translate the image, I actually translate which feature detector responds, so the translation goes through the system. One problem. Another problem with convnets is they don't produce the parse tree for an image, and it seems sort of psychologically realistic to think when I see a scene, I do something

like parsing it. I know which parts of which and which parts belong to which wholes. That's one thing they don't do—convnets. Another thing they don't do is they don't assign intrinsic frames of reference to objects. So many of you are psychologists or like physicists, so you will know these examples, but if you look at the—yeah, if you look at the object on the left, that, yes, if I do, if I just tell you it's a country, you initially see this kind of reflected Australia. As soon as I tell you that

it's at a diagonal orientation, you can see that Africa, right, is very familiar once you get the right orientation. But if you don't get the right orientation, it's not drill familiar. If you look at the object on the right, you have two completely different ways of seeing that. You can see it as an upright diamond, or as a tilted square, and those are completely different internal representations. Now, convolutional nets don't have anything like that. A convnet, you put the data in, it goes through, you recognize the object, but it's not like the same—the very same pixels can lead to two completely different interpretations. In a convnet, because the convnet doesn't do anything like explicitly imposing a frame of reference, and I can argue that

explicitly imposing frames of reference is what you need to do to deal with viewpoint properly. So, I’m going to try and make this problem even more evident by showing you a little puzzle I found in a Christmas cracker many years ago, and what we're going to do is we're going to take a solid tetrahedron and we're going to cut it into two with a plane, okay? So this is going to be a jigsaw puzzle but a 3D jigsaw puzzle, and it doesn't sound that hard, right? If I tell you I'm going to take a solid tetrahedron and then cut it with a plane, and then what I'm going to do is I'm going to do an experiment on MIT.

Professors, I'm gonna give our mighty professors these two pieces of a tetrahedron, and I'm gonna say, these make a tetrahedron. A check—they know what a tetrahedron is. And I can say, can you put these two solid pieces together to make your tetrahedron? And they can't. It turns out, in fact, it takes them a long time, and the number of minutes it takes them is about equal to the number of years they've been at MIT. So the young ones get it in a few minutes, and the old ones just don't get it. Some of them give up on one. An MIT professor called Carl Hewitt, who I tried this on a long time

ago, after 10 minutes he proved that it was impossible. Okay, now you may wonder why this is so hard. So I have our demonstration kit. I think Ian would have appreciated this because it involved making something. Now part of the point of this demonstration is these pieces are large and clumsy, so it's hard to manipulate them, and that makes it much harder. So here we are, these two pieces misunderstood. These two pieces make a tetrahedron, right? They're identical. Okay, and here's what people do: they say, well, you know, the reason I've got to put two faces the same together, so let's see. I'm gonna put those together. No, that's not a tetrahedron.

Let's see, well, that's clearly not a tetrahedron, and last military Heatran. And then people do this, and I watch them do it, they say vast military, and what about this? That's not a tetrahedron. Um, I don't know, how do you make a set region? What is a tetrahedron? Um, and people will spend a long, long time. Now just occasionally people get it almost immediately, maybe because they'd seen it before or maybe because they went to a U.S. public school a long time ago where they got milk delivered in tetrahedron, tetrahedral cartons, and they stack them in a particular way. So let me show you how you make a tetrahedron in case some of you haven't figured it out yet. You do it like that. Okay, and the question is why can

presumably intelligent people like MIT professors not see this? It's not that hard, right? If you think about it, there's only three different face types or face here: there's the little triangle, the big trapezoid, and the rectangle. Well, part of this, since you're psychologists, is it's a real-life Müller-Lyer illusion. So actually people don't perceive it as a rectangle. So if you show people this, you see this guy has an arrow coming out and sort of coming out, and this guy has an arrow going in. So actually people perceive that as not quite square, and that helps to explain why it's so hard.

It's an illusion involved, but nevertheless you'd thought they would be able to get this in less than 10 minutes. Now I'm going to try and explain, apart from the illusion aspect, why it's so hard. The reason it's so hard is because when you see this object, you impose an intrinsic frame of reference on it. That is, it has three axes, one of which goes this way, and one of which goes this way, and one of which goes that way. It's a rectangular coordinate frame you impose on this, and you perceive it relative to that rectangular coordinate frame, and you have two of them, and they're the same, so you want to align their coordinate frames, which is what you do with reflection. And that doesn't

work. If you look at how this fits into a tetrahedron, then the rectangular coordinate frame of this piece is nothing like the coordinate frame you impose—the tetrahedron for the whole tetrahedron. There's a vertical that goes down through the vertex, and then you have to break symmetry for this triangle somehow to get the other axis, but it just doesn't align with the coordinate frame of a tetrahedron. Now, there's a completely different psychological representation of a tetrahedron that is inside your brain. You can represent a tetrahedron in a different way. You can represent it as there's a horizontal edge at the top, there's a horizontal

edge at right angles at the bottom, and you just put in all the lines that join those two edges, and they make it edge region, right? It's the sum of all the lines joining those two edges. If you perceive a tetrahedron like that, it's a completely different psychological object, and it's very easy, if you perceive it like that, to see that you can cut it with a plane that makes a square cross section because near the top is direct / one-way, and near the bottom is a rectangle the other way. So the same mathematical theorem says in the middle it better be a square. So the point of this long, long demo is that the way you see things depends on rectangular frames of reference you

impose on them, and convenience doesn't explain that at all because computers don't do that. Okay, so what I'm gonna do is take standard feed-forward neural nets and change them in quite a few ways in order to try and get something that deals in a principled way with viewpoint. If you think about the current neural network technology we have, it's obviously not exactly like the

brain. It's inspired by the brain, but the way the neurons work isn't just like the brain, and it was—you're just kind of made up. People who came to the field lately somehow think there's something magic about neural nets. We just made it up. Okay? For thirty years we used logistic units, and then after 30 years we decided, hey, why not use rectified linear units? And rectified linear units, so much easier to optimize. Neither of them are exactly what neurons do, but the important thing to remember if you're new to neural nets is it's all just made up, right? It's just engineering, and people try things that worked. What we've really discovered if you're off work

More people have empirically discovered—who've been doing your own nets—the thing they've really discovered, that's a big surprise even to some of them, is that if you take a system with a whole lot of parameters and you optimize it by stochastic gradient descent, that is, you give it a small subset of all the training cases and you say, on that small subset, figure out how to change the parameters to get better answers, and then take a small step in that direction or a related direction, and then do it again for another small set of examples—that works. It sort of doesn't have any right to work, but it really works, and that's actually asymptotically, you can show it's as efficient as you could be.

So even this dumb optimization algorithm is asymptotically efficient, so you're never going to beat it by a whole lot, not hugely, not kind of polynomial e. And so that's what we've really discovered, and now the question is what kinds of systems are we going to apply this stochastic gradient descent to? And currently the systems we use have a lot of problems. So here's one thing that's wrong with standard neurons: they can't tell if two inputs are the same. Okay, our standard neuron is a linear filter for a bad non-linearity, and you can't make a neuron that if I give it a 1:1...

...says yes, and if I give it a zero zero, says yes. They give it a one zero or zero one, says no. That's the XOR problem, and the standard solution to it is to say, "Well, let's put in the hidden layer that'll separate out the cases and then recombine things." And that works, and that has been accepted as the way you deal with this, but it's not the only way to deal with it. We could deal with it by having a different kind of neuron, okay? Something that can recognize where the two things are the same. And notice that's, I've got a very different flavor from the neurons we use at present because the neuron that can recognize where the two things are the same can do with covariance structure directly the...

Neurons that just are linear filters are always multiplying an activity vector in the layer below by a weight vector to see if they should be active. That's very different from looking at two activity vectors and seeing if they agree. And this talk is going to be about a system that looks at activity vectors to see if they agree, and that, as their sort of primitive operation, can tell whether two things are the same. That's one thing wrong with our neurons. They also have, if you're an engineer, they have surprisingly little structure. You've got neurons, you've got weights, you've got neurons, you've got layers, and you've got whole networks, and that's about it. You've got some architecture of how the layers are connected. I'm going to suggest...

...we should actually have something between a layer and a neuron, which is a small group of neurons which I'm going to call a capsule. And the idea of capsules is you're going to do a bunch of internal computation, and the capsule is going to have some neurons in it, and the activities of the neurons in a capsule are going to represent different dimensions of the same thing. So if you want to represent a multi-dimensional object, you'll have a little group of neurons. If you want to be able to represent ten degrees of freedom, you'll have ten neurons in there that represent the values on the different dimensions. And the way we know that those ten values go together as properties of the same thing is that they're in the same capsule. I can't just have a big layer of values because then...

...I don't know which values, values of what. I want to be able to represent several things at once, so I need to package the things just like you do in a computer. So in the visual pathway, what a capsule is going to do is a capsule will learn to represent objects, object parts of a particular kind, and it'll have associated with it a single logistic unit that says whether this object, object part, is present. So it needs to decide whether the thing it represents is there or not, and almost all the time...

...for almost all the things, they're not there. That's how vision is. And then in addition to that, it's going to have two other things. I'm only going to talk about one of them. It'll have something that represents the viewpoint that you have on this part, and as you change your viewpoint, those parameters will change. And then computer graphics, a standard way to represent viewpoints will be with a four by four matrix in 3D, so it'll have a little matrix associated with it which says what’s the relation, what’s the viewpoint, which amounts to saying what’s the relation between the camera and the intrinsic frame of reference you've imposed on this part.

Notice that you can't say what the viewpoint is, you can't put numbers into this matrix unless you have an intrinsic frame of reference. And if you put a different intrinsic frame of reference on the same thing, like turning a diamond into a square, then you'll get a different representation as relation between that thing and the camera. The position will be the same, but the orientation in that case will be different. So the fact that we always impose frames of reference suggests that we're using, reusing some way of representing the relationship between the camera and the object part using the fact that we've got this frame of reference embedded in...

...the object. Okay, now once you go for this idea that you're going to have a little group of neurons, the different dimensions in the little group of neurons going to be representing different properties of some object or object part, then you have the problem, the "prop" problem: what happens if two instances of that kind of thing occur in the same part of the visual field? So one way to solve that is to make the capsules only respond to a very small region of the visual field, and so low down, when they're representing simple things like edges, they're going to have small receptive fields, but as you get higher up and you have a capsule...

Responding to a face, you're going to get a serious problem if you have two faces in the same part of the receptive field. So if you take two transparent spaces and superimpose them, you'll have great difficulty seeing what's going on. And we're going to make a very strong representational assumption, which is that you only have, for each part of the visual field, you only have one capture of each type. If it's representing low-level features, got a small area. If it's representing a high-level feature, got a big area covers, but you're only like one of them. That's the price of being able to use activities of different neurons to represent where you are on different coordinates. You're binding it together by saying these are different properties

of the thing that's here, and there better only be one thing. A consequence of that is that if you ever do get things of the same kind very close together relative to the size of your fields, your system's gonna get very confused. And there's a lot of evidence, called crowding, that in perception you do get very confused when you have things of the same kind close together and you can't put your folder on one of them. So if you're slightly peripheral vision, you put two things of the same kind close together, you get all mixed up. They're very hard to see. Okay, so there's some psychological evidence of this crazy assumption, the only like one thing of each kind at each place is that may actually be true. Okay, now how are my

capsules gonna work? How are we going to recognize objects by recognizing their parts? Well, the idea is let's ignore the front end of the system to begin with. Let's hope you've already got two low and double capsules. And like I say, how do you get to high-level capsules now? So the idea is that to detect whether an object's there, you're going to get votes from smaller pieces saying what the pose of the object should be. When I say pose, I mean viewpoint, what viewpoint you have on this thing. And these votes are going to come from smaller things you have viewpoint self, and these votes, there'll be smaller things that aren't

part of the object that may be making votes, and there'll be kind of irrelevant votes that are voting for crazy things. And then there'll be the actual parts of the object that make votes to the degree—and when you see this agreement, agreement is crucial here. So agreement between activities, you get these little voting vectors, then you say there's something really there. So what you're doing is you're looking for a high-dimensional coincidence. So if you think of all the votes as those blue dots and the red dots as votes the degree, you would then say forget the outliers. We've got a whole bunch of votes that agree on something and that's significant. So if you think about it, if you've got a

cluttered or noisy environment, high-dimensional agreement is a very good thing to use to filter stuff out. Like if you're listening to radio traffic and you see in the radio traffic "New York" and that occurs a few times, and you see in the radio traffic "September" and that occurs a few times, and you see "the ninth" and that occurs a few times, that should maybe alert you. But if you see New York, September the 9th, and that occurs in three different messages, you should think, you know, we've got a high-dimensional coincidence now. We've got a coincidence of, you know, the month and the day and the place, and we've got several things if

several votes for that. And because it's a high-dimensional space, that's not likely to happen by chance. And so now we've got very strong evidence, much more than just the evidence for September or the ninth or New York. Okay, so the idea of capsules is that they're going to work by doing high-dimensional consensus filtering, which involves comparing predictions. And this is the sort of—this is the central slide of the talk. If you understand this slide, you've understood the main point of the talk. We're going to have one layer of capsules where we've already decided whether they're there or not, and if they are there, what their pose is. That is, what's the relationship between the camera and the intrinsic frame of reference imposed on

this plot. And let's suppose we have two parts: mouth, inner nose, and we know their relationship to the camera, and that's where the face is, just a rigid object. Then, if you know the relationship of the mouth to the camera and you know the relationship of the mouth to the face, you can predict the relationship of the face to the camera. And that's just a matrix multiply. You have a bunch of numbers that represent the pose of the mouth. You multiply them by a weight matrix. So these are activities, and as you change the camera position or move the mouth around, all those activities change.

There's nothing invariant about them; they're highly variant. But the relationship between the mouth and the face is something that's completely invariant. That doesn't depend on viewpoint. Okay. Oh, oh, the microphone has gone off. I can't hear it. But sorry, somebody should have said... Thank you, sorry. Oh, okay, it's live. Don't know. Okay, so you'll believe what I say more. Okay, so the

relationship between the mouth and the face does not change as you change your viewpoint. So if you want to get invariant knowledge about objects into a system, into a neural net, the place to get the invariant knowledge is into the relationship between parts and wholes. That's what's invariant, at least for rigid objects. What's variant is where the pieces and the whole object are and what orientation they're in. You don't want to try and make that be invariant, of course. The final name of the object, well, that little P, the probability that this part is there, that's something you want to be invariant across some really reasonable range. So that is something that's long be invariant, but you're also getting all

This stuff that's equivariant as you change the camera or change the object, all this stuff varies but varies together. So what you'd like is that the pose of the mask, the relationship between the mouth and the face, predicts the pose of the face. The same with the nose. And if those two predictions agree, and there's all sorts of issues about how well do they need to agree, if they agree, you believe there's a face there. So really, what you'd like to see is several predictions, and you'd like to see them agreeing tightly. And you're going to do a trade-off: if there's a few little degrees, really well, that's good; if there's a lot that agree, not so well, that's also good. And that's how we're going to try and recognize holes from their parts. And of course, we're not going to hand-wire this stuff; we're going to hope the system can

just learn all of it by doing stochastic gradient descent. But we're going to wire up a system in which it should be possible to learn that. So the point here is that as viewpoint changes, all of these poses change, but the relationship between the pose of the face and the pose of the mask doesn't change. That's fixed. That's where the invariant knowledge is going to be, and that's in the weights. So what motivated all this is how do you recognize things from new viewpoints? And one approach is to have a longer training data. That's the sledgehammer approach. And a better

approach is to say, look, if you take images of the same rigid shape and you change viewpoint, the things being imaged jump to different pixels, and that's a big mess for machine learning if you're going to do machine learning on the pixels. And that jump, if you look at it in pixel space, is a big mess. But if I take an object and I image it from one viewpoint, and then I change my viewpoint, image it from a different viewpoint, I can't just average those two images to get an image of the object from the intermediate viewpoint. It's nonlinear. If I average those two images, I get sort of two ghost images that are separate. What

we'd like is a space in which things are linear. And to get that linear space, we're transforming to the space of identified features with coordinates. So how long to blend two people's faces? Two people's faces, like, for example, Michael Cohen and John Dean. I might want to blend those, but I wouldn't try blending the images. I try recognizing the relevant pieces and then blending those coordinates, and then that'll work. Okay, so here's a piece of logic. Graphics programs have no problem dealing with viewpoint. If a graphics guy is showing you an image and you say, "Shift to me from a different viewpoint," he won't say, "Oh, well, I didn't train from

that viewpoint. You can't really expect me to do that. You've just shown it to me from a different viewpoint." And we have no problem recognizing things from new viewpoints this pretty much. And therefore, by infallible logic, we have graphics programs in our head. Oh, okay, that's the best logic only used today. So the point is, if you ask what does viewpoint do to images in the pixel domain, it really messes them up, but if you can get to coordinates, well, you represent the relation between the camera and a part of an object in that

domain, the viewpoint does very simple things to the coordinate representation. Everything is linear. I'm going to assume here—I'm going to say perspectives are too complicated for me—to say this; you're more toward graphic reaction. But assuming that everything's nice and linear and you can make perspective linear if you do some work. Everything's nice and linear, and we're crazy not to be using that linear structure. It's a simple structure that completely deals with viewpoint. It doesn't deal with other things like deformations, non-rigid transformations, but viewpoint, which is the main source of variation, is completely dealt with in this linear way by going to those coordinates. So that's what we ought to be doing. So now let's talk about, once we've

decided to go to coordinates, how are we going to do segmentation? Because if you find a bunch of parts, you might find a part that's, for example, a circle, and that circle could be an eye—the left eye of a face, or the right eye of a face—or it could be the front wheel of a car or the back wheel of a car. You don't know for sure what it is. And so you're going to have to make a bunch of votes about what it might be and then look for coincidence to decide on what it is. And we're going to assume that for every part you find, it belongs to at most one whole. It might be an orphan, but if it

belongs to a whole, it's most one of those. So what a part has to do is it has to look to see, it has to vote for various wholes, and then it has to look to see whether its vote appeared inside a cluster of other votes or whether its vote was an outlier. And initially it won't really know. You've got this circle, it doesn't know whether it's part of a face or part of a car, so it scatters lots of votes, several possibilities. Then it needs to look to see whether those votes agreed with votes coming from other places. If they agreed, it says, "I'm okay. I need to focus my votes there." So we're going to have to have an iterative process that does segmentation by, initially, you have these rather vague

votes, or these votes that vote for a proposed for each thing, but aren't very confident. And each part will spread its votes over many things. And then you'll get some top-down, which will say, "Please, from these high-level captions, it'll say, please send more of your vote to me because you agree with my cluster," or "Please send less of your vote to me because you're an outlier." And we can do a few iterations of that. We actually do three iterations, and the system will quickly settle down to sending the vote from a part to a capsule that's receiving other votes that agree with it, and it settles down surprisingly fast. So, here's the picture: for each part, we have what we call a

Routing softmax. Think of it in terms of: with what probability should I belong to each of these higher-level capsules, and the sum of those probabilities should be one, assuming you're not an orphan. So, initially, the probabilities will all be small, and for the particular part we're looking at in this slide, it might send a vote to capsule K that agrees with the cluster of other votes that come to capsule K. And I hope capsule J is an outlier. And the reason you can be an outlier in one foreign capsule and in life or the

other capsule is because when you send your vote, you multiply your votes by the part-whole relationship between the part and the whole, and that's a different part-whole relationship for these two capsules. So the two higher-level capsules have different views of this part because they see the part filtered through different part-whole relationships. So a bunch of parts that are seen as all agreeing by capsule K might be seen as disagreeing by capsule J because they're filtered through different part-whole relationships. Okay? And that's why this converges much faster than under clustering algorithms. You can think of the high-level capsules as like the cluster means; there's

like the clusters. You can think of the lower-level capsules you've discovered already as like the data, and you're trying to explain this data in terms of these clusters, and you're actually going to run the clustering algorithm during perception, which sounds crazy, but it settles very fast because each of the higher-level clusters has a different view of the data because it sees it filtered through different part-whole relationships, and that's why it converges in three iterations instead of like 50. So the objective function for doing the routing is to try to get the active capsules in one layer to explain the

capsules in the layer below, and what we're doing is actually a version of the EM algorithm for fitting a mixture of Gaussians to data, but it converges much faster because each component of the mixture has a different view of the data, and so that breaks symmetry very strongly. I'm not going to go into the details of this; all the details are in a published paper that was in ICLR in 2018, and I'll give you a reference down at the end. This is mainly for a machine-learning audience, but the important thing is that there's an inner loop that happens during perception when

you're finding these clusters and send the information back saying, "Please send me more" or "Please send me less," and it'll settle down to nice clusters. And that's what's doing the segmentation, of finding the wholes to combine these parts into, is to solve the assignment problem of assigning wholes to parts. That's not the learning algorithm; that's just an inner loop thing that's deciding which parts get combined into which wholes. Then in the outer loop, there's a learning algorithm that's trying to make the clusters tighter or trying to make them less tight. It's important that sometimes the learning tries to make them less tight because if you find that thing, then it's part of some larger thing

which you don't want to see in that image because you're told it's not there. And so we're going to do discriminative learning for all of this. So the high-level decision about what the object is is going to send back information saying, "Oh, you're claiming it's a cat, but actually it's a dog, so please don't see this cat's ear here." And you'll get information coming back that says, "Make those votes for the cat's ear be less well clustered and make the votes for the dog's ear be better clustered." Okay? Similarly, the relationship between the parts and the wholes—we're doing discriminative learning for that. If we did unsupervised learning in this

version of capsules, it wouldn't work, because what would happen is it would say, "Boy, I know how to get really good clusters; I can just make everything vote for zero." And if everything votes for zero, so we use transformation matrices that just sort of throw it away and vote for zero, then you get really tight clusters, but you wouldn't really explain anything. Okay? It'll collapse. And that's the problem you get with unsupervised learning: as soon as you try and minimize squared distances in a domain that you completely control. If you minimize squared distances when you reconstruct the input, that's fine because you don't control the data. There's real data, and then you're trying

to make predictions to fit with it. But if you've got two different things making predictions you want to fit, that's really easy if you train it just to fit. You've got a training discriminative loss so it doesn't collapse, or you've got to have a better objective function. Okay? So what we do is we do these three iterations to do the assignment after we've established the low-level capsules, then after we've done the three iterations we've now established the next layer of capsules. Then that's all finished, and then we go to the layer above that, and so on. And we're doing it greedily in the sense we establish the parts once we've established the parts we don't change the poses at the past field. I'm not going to use top-down information to revise our

opinion about where the parts are, and so we're doing it sort of greedily, a layer at a time. But for each new layer, there's three iterations of routing, and then to do the gradient descent we just unroll that routing, which you've been doing something like TensorFlow, and just backpropagate through everything to change everything so as to get the right answer. I just said that. Um, so here's a little proof-of-concept. We thought that once we got this working, we could then scale it up to something bigger, and I'll come to why we haven't done that yet later. So it's a, it's a...

Task created by Yellow Comma, which is: you take little plastic toys that you buy in a toy store, and for each object class you have five examples that are training ones. So, five little plastic cars — they're the training cars. You have five different ones that are going to be the test cars; they're different cars, different physical objects. You paint everything green, and you now put it on a turntable, and you have lots of lights, and you get to see it from many viewpoints, both in azimuth — I think that's azimuth — and in elevation with many formation conditions. And so you make yourself a big day.

Set of these five instances of each of the five kinds of objects, viewed with many viewpoints. But then, what you have to do at test time is recognize a new instance of that kind of object. So you might be trained on elephants and crocodiles; you might have to recognize a hippopotamus. So here's some examples of what the images look like when they've been downsampled a bit. You get images from many different viewpoints: those cars and trucks and animals and airplanes and people. This was done in the United States, so the concept of a person includes that they're holding a weapon.

Every single instance — every single instance of a person is holding a weapon. That's how you tell different people or animals. Okay, so now I talked about how you deal with geometric relations, but actually, if you think about computer graphics, you take an object from the pose of the whole, you figure out the poses of the parts of the object. You go down a hierarchy like this until you get to little triangles, and then you have to render it. When you get to little triangles that are the surface of an object, describe the surface, an object up till then is geometry and there's nothing to do with light or reflectance.

But then luck comes into it. You're not really interested in light; it's just a way of seeing things. You're interested in what's there, unless you're an artist, and then you render it. And we need to invert the rendering process, and that's very different from inverting the geometric aspects of it, which is what I've been talking about. So we need two bottom-level 3D renders, and the way we're going to do that is we're going to take an image, we can apply a bunch of filters, we're going to have a stack, and at each point in the image we're going to have a stack of 128 different 5x5 filters. Then at each point in the image, we're going to take that big vector of activities and we're going to convert

That into that vector — visit that centered at that point, also the nearby activities of this stack of 128 filters. And then centered at that point, we're going to have 32 different types of primary capsule, and for each of these primary capsules, we're going to, from these filter outputs, we're going to decide whether it's there or not, or with what probability it is there, and what its pose is. So little 4x4 matrix that describes its pose. So this is a very primitive way of doing 3D rendering. We're working on much better ways of doing it by actually taking a renderer, I'm backpropagating through it to train a 3D renderer. But for now, we're just going to use that; it works well enough. And then

Once we've got the primary capsules, we then have some layers of capsules, but the whole thing is going to be convolutional. That is, each capsule will have pose parameters that say the precise position and orientation and scale and so on, but the capsule, we replicate it across space so that you can see two eyes at once. Two hours on top of each other, you'd be confused by the two eyes that are separate. You see both of those at once. I'm saying that we make this whole thing convolutional so that it deals with translation just by replication. That's with coarse translation. The fine-scale translation within a receptive field is dealt with in the pose matrix, so it's got a

Completely different way of dealing with fine changes in position and dealing with coarse changes. It's a bit like if you take the mobile cell phone, you move around in the same cell tower. It deals with you; that's like your capsule. Then after a while, you get handed off to another cell tower. That's when you get represented by a different capsule. Okay, so after we got the primary capsules, we have some more layers of capsules, and then at the top we have capsules that represent individual classes. And so there'll be five of those for animal, person, truck, plane, and whatever the other thing was — car. Yeah. Um, this is a

Well-studied benchmark, and so you can look at how well various systems do. So a standard CNN without a lot of work built into it does 5.2 percent error on the test data. The best CNN in the literature that we could find does 2.56 percent. That was done by Sarah Sun working with Schmidt Hooper, and he did lots and lots of pre-processing to get the best performance they possibly could. If you take a previous version of capsules that we published in NIPS, I got 3.6 percent, and then with these capsules that have these little pose matrices and use this clustering algorithm, we get 1.8 percent error. Now, this is

Ideal for what we do. So this dataset is kind of ideal for testing this idea, and we better be able to beat the opposition on this ideal data. If you take your clutch background and add that, that confuses our system. We still do slightly better than the rest, CNN, but not a lot better. If you look at extrapolation to new viewpoints, then what you can do is you can train on a limited range of azimuth and then test on azimuth outside that range, or you can train on a limited range of elevations and then test on elevations outside that range. Now, because capsules do better than CNNs, they're going to win anyway, so

What we do is we take a CNN. We sort of train it to completion on the limited range of data, and then we take our capsule system and we train it until it gets the same performance as the CNN. So when we had a limited range of azimuth, the CNN trained on the training data got 3.7 percent error. Sorry, yeah, it's trained on the familiar viewpoints, it gets 3.7 percent error. We train the capsules to get the same, and then we test on the extrapolated viewpoints, and the capsules generalize a lot better than the CNN, showing that it's not just the capsules work but is that they

generalize better. And we do the same validation, and again, they generalize a lot better. It's not as much as I'd like, but it's definitely much better. Now, you might ask if you're a computer or an old-fashioned computer vision person, you might ask, why isn't this just a Hough transform? Because in computer vision, they have Hough transforms for finding parts that are related, right? And, well, it is just a Hough transform, but it's what you might call a nonparametric Hough transform. So in Hough transforms you would make a big array and a part would vote in this array, and if it's a degenerate part, like if it doesn't have all degrees of freedom, it will put a big

streak of votes in this array, and then you look for the intersections in the array. The problem is if you want to have six degrees of freedom, you'd need a 6D array, and that will be hopeless. So it's normally only done for two degrees of freedom or sometimes three. So what we're doing is we're saying, suppose you could learn parts that have all the degrees of freedom of a viewpoint. Then if this is a fully specified part, I can now make a point vote in the space for the whole. I don't need to have an array where I scatter lots of votes; I make an unambiguous point vote. And now, instead of having this big array for the viewpoint on the

whole thing, we just have these votes that come from the parts we happen to have, and we look for clusters among those votes. And that's how we get over the problem of having to tile a six-dimensional space. Of course, we do this business of looking for votes in the six-dimensional space, and we convolutionally tile that over the image, so we're doing it over the image but for large things it’s coarse tiling. So that's how we're kind of dealing with the basic problem regime, the basic problem of Hough transforms in two ways: one is by not gridding the space, just using convolution for the two degrees of freedom, and the other is by making sure that our parts have enough degrees of

freedom so they can make a point vote. And it's very hard to do that by hand unless you're David Lowe. David Lowe, that was the point of SIFT features, to allow you to do Hough transforms, but I got forgotten. When people learned about machine learning, they threw away the point features and just did dumb machine learning on bags, as if featureless machine learning was kind of a disaster for vision because it threw away all that good old-fashioned geometric vision, which is what we need to deal with viewpoint properly. I enjoy saying that. We try to scale this up to big images and there's just a kind of hardware problem, hardware software problem. All the hardware software design for neural nets is designed to optimize

things for big matrix multiplies, and when we try and scale it up we just run out of memory right away. And it's because this software is keeping too many copies of things. We need to use the software that does automatic differentiation because if you try and backpropagate through these unrolled loops in computers all by hand, it's a pain. So present is just a technical difficulty making it scale up, but there's also some much more serious problems than those practical ones. So there's all sorts of things wrong with what I just told you, and so I'm going to go over some of the main things wrong with it. One, or I've already mentioned, you'd like to do unsupervised learning to learn all this structure and just

have a little bit of supervised signal when you get labeled examples, just that'll help it out. But if you try and do this using unsupervised learning, the transformation matrices all collapse and all the votes just predict the origin, and they all say, "Hey, I agree," really nicely. And that's because you're trying to optimize something in a space that you control as opposed to a space where the data is fixed under specified poses. Like a circle: if you have a circle, you don't know what orientation it's in, and so you can't predict the orientation of the whole. It's easy from a whole to predict the part, but the part might be

degenerate. Like if you imagine a constellation of stars, from the constellation you can predict where the stars are, but from an individual star you can't predict much about the constellation because you don't know the orientation. And the third major problem is actually Sarah Sabour, who made this all work, had to put a lot of work into tuning the whole system. That is the learning rate, various things, because to say that a cluster is there, you need to have found a cluster that has multiple points that are close together, but obviously you're doing a trade-off between how many points and how close, and that trade-off is going to vary during the learning. At

the beginning of learning, the cluster is going to be poor because you haven't learned the transformation matrices properly yet, and you can't just say there's nothing there. You have to allow it to say the cluster might be there even though it's a very full cluster. As long as buying, you need to let all that change. So it gets much more demanding about how tight the cluster has to be for it to be there, and just getting all that to work was painful. I mean, like months painful. I want to just show you before I finish, need doing segmentation, but this is an earlier version we had of capsules, but I just want to show you they can do quite impressive segmentation using these same general ideas. But this was a somewhat earlier version. There works in a

Slightly different way, so these are just on some NIPS digits, and what you're seeing in white is what the computer sees, and it's made by superimposing two digits but with a small offset. And what you're seeing in color underneath is the best two digits found by the capsule system. The top two best, and I draw one in red and the other in green, so the overlap will be yellow. And so you get to see that it didn't actually—it did actually manage to see the two digits, and in cases like, for example, the

already get it right. Yes, in cases like the one in the bottom row, second from the right, if you look at that, it's quite hard to tell what's going on. I think it correctly perceives that as a five; that's what it really is. Now, of course, this case is when it gets it wrong, and I'm not showing you, but it gets about half the number of errors that the best CNN could do. I should say, the systems are trained on overlapping digits, so it's not that it'd be much better if it's trained all single digits and the first time you showed an overlapping pair it says, hey, there's two digits there. But these are actually trained to see two overlapping digits. If you don't do that, a CNN

can't do it at all. And now I'm done. So, three published papers on capsules: an early one called Transforming Autoencoders in 2011, and then there's one in NIPS that does that segmentation of digits, as I just showed you, and then the thing I talked about today is in ICLR in 2018—that's Matrix Capsules. And there's a new version of capsules we're working on that I hope to talk about today, but it doesn't work yet, and I don't want to talk about something until it works, and we're hoping that we'll be in NIPS 2019. Okay, I'm done.

(applause)

From YouTube captions, lightly punctuated for readability. Timestamps link to the video above. Errors are possible.

Cite this recording

Geoffrey Hinton, “Dynamic Routing Between Capsules (2017)”, NeurIPS/academic conference circuit, 2017. Transcript and video: Thinkers Archive, https://thinkersarchive.com/geoffrey-hinton/capsule-networks-keynote-2017/

Quoting a passage? Link to its exact moment: every timestamp above has its own anchor (for example https://thinkersarchive.com/geoffrey-hinton/capsule-networks-keynote-2017/#t-137).

Search every transcript
Open the full search page →