Placeholder Image

Subtitles section Play video

  • So today, I thought we talk about generative adversarial networks because they're really cool, and they've

  • They can do a lot of really cool things people have used them for all kinds of things

  • Things like you know you draw a sketch of a shoe

  • And it will render you an actual picture of a shoe or a handbag

  • They're fairly low-resolution right now, but it's very impressive the way that they can produce

  • real quite good-looking images

  • You could make a neural network

  • That's a classifier right you give it lots and lots of pictures of cats and lots and lots of pictures of dogs

  • and you say you know you present it with a picture of a cat and

  • It says it outputs a number. Let's say between zero and one

  • and

  • Zero represents cats and one represents dogs and so you give it a cat and it puts out one and you say no

  • That's not right should be zero and you keep training it until eventually it can tell the difference right?

  • so

  • somewhere inside that

  • Network

  • It's... it must have formed some model of what cats are and what dogs are, at least as far as images of

  • images of them are concerned

  • But

  • That model really... you can only really use it to classify things

  • You can't say "ok draw me a new cat picture", "draw me a cat picture I haven't seen before"

  • It doesn't know how to do that so quite often you want a model that can generate new

  • Samples you have so you give it a bunch of samples from a particular distribution, and you want it to

  • Give you more samples which are also from that same distribution, so it has to learn the underlying

  • Structure of what you've given it. And that's kind of tricky, actually.

  • There's a lot of...

  • Well there's a lot of challenges involved in that.

  • Well, let's be honest

  • I don't think as a human you can find that tricky

  • You know if... if I know what a cat looks like but, uh, being not the greatest artist in the world

  • I'm not sure that I could draw you a decent cat. So, you know, that this is not confined to just

  • Computing is it? This...

  • Yeah, that's true. That's really true.

  • but if you take

  • Let's do like a really simple example of a generative model

  • say you you give your network one thing

  • It looks like this.

  • And then you give it another one you're like these are your training samples looks like this

  • You give it another one that looks like this, and then...

  • What are those dots in the systems?

  • Instances of something on two dimensions?

  • Yeah, I mean right now, it's literally just data. We just... it doesn't matter what it is

  • Just some... yeah, these are these are data points

  • And so these are the things you're giving it, and then it will learn

  • You can train it. It will learn a model, and the model it might learn is something like this, right?

  • It's figured out that these dots all lie along a path, and if its model was always to draw a line

  • Then it could learn by adjusting the parameters of that line

  • It would move the line around until it found a line that was a good fit, and generally gave you a good prediction.

  • But then if you were to ask this model:

  • "Okay, now make me a new one"

  • unless you did something clever, what you get is probably this, because that is on average

  • The closest to any of these, because any of these dots you don't know if they're going to be above or below

  • or, you know, to the left or the right. There's no pattern there. It's kind of random.

  • So the best place you can go that will minimize your error, is to go just right on the line every time.

  • But anybody looking at this will say: "well, that's fake"

  • That's not a plausible example of something from this distribution, even though for a lot of the

  • like, error functions, that people use when training networks this would perform best, so it's this interesting situation where

  • There's not just one right answer.

  • you know, generally speaking the way that neuron networks work is:

  • you're training them towards a specific you have a label or you have a

  • you have an output a target output and

  • You get penalty the further away you are from that output, whereas in in a in an application like this

  • There's effect... there's basically an infinite number of perfectly valid

  • Outputs here

  • But, so, to generate this what you actually need is to take this model and then apply some randomness, you say: "they're all

  • Within, you know,

  • They occur randomly and they're normally distributed around this line with this standard deviation" or whatever.

  • But a lot of models would have a hard time actually

  • picking one of all of the possibilities

  • And they would have this tendency to kind of smooth things out and go for the average, whereas we actually just want

  • "Just pick me one doesn't matter". So that's part of the problem of generating.

  • Adversarial training is is help is a way of

  • training

  • Not just networks, actually, a way of training machine learning systems.

  • Which

  • involves focusing on

  • the system's weaknesses.

  • So, if you are learning... let's say you're teaching your

  • Network to recognize handwritten digits.

  • The normal way you would do that you have your big training sample of labeled samples

  • You've got an array of pixels that looks like a three and then it's labeled with three and so on.

  • And the normal way

  • that you would train a network with this is you would just

  • Present all of them pretty much at random. You'd present as many ones as two as threes and just keep throwing examples at it

  • "What's this?", you know, "Yes, you got that right", "no. You've got that wrong, It should really be this".

  • And keep doing that and the system will eventually learn

  • but

  • If you were actually teaching a person to recognize the numbers, if you were teaching a child

  • you wouldn't do that, like, if you'd been teaching them for a while, presenting them and

  • You know, getting the response and correcting them and so on, and you noticed that they can do...

  • you know... with 2 3 4 5 6 8 & 9 they're getting like 70 80 percent

  • You know, accuracy recognition rate.

  • But 1 & 7 it's like 50/50, because any time they get a 1 or a 7 they just guess because they can't

  • Tell the difference between them.

  • If you noticed that you wouldn't keep training those other numbers, right? You would stop and say:

  • "Well, You know what? we're just gonna focus on 1 & 7 because this is an issue for you".

  • "I'm gonna keep showing you Ones and 7s and correcting you until

  • The error rate on ones and 7s comes down to the error rate that you're getting on your other numbers".

  • You're focusing the training on the area where the student is failing and

  • there's kinda of a balance there when you're teaching humans

  • because if you keep relentlessly focusing on their weaknesses and making them do stuff they can't do all the time

  • They will just become super discouraged and give up. But neural networks don't have feelings yet, so that's really not an issue.

  • You can just

  • continually hammer on the weak points

  • Find whatever they're having trouble with and focus on that. And so, that behavior,

  • and I think some people have had teachers where it feels like this,

  • It feels like an adversary, right? it feels like they want you to fail.

  • So in fact

  • you can make them an actual adversary. If you have some process which is genuinely

  • Doing its best to make the network give as high an error as possible

  • that will produce this effect where if it spots any weakness it will focus on that and

  • Thereby force the learner

  • To learn to not have that weakness anymore. Like one form of adversarial training people sometimes

  • Do is if you have a game playing program you make it play itself a lot of times

  • Because all the time. They are trying to look for weaknesses in their opponent and exploit those weaknesses and when they do that

  • They're forced to then improve or fix those weaknesses in themselves because their opponent is exploiting those weaknesses, so

  • Every time

  • the

  • Every time the system finds a strategy that is extremely good against this opponent

  • The the opponent, who's also them, has to learn a way of dealing with that strategy. And so on and so on.

  • So, as the system gets better it forces itself to get better

  • Because it's continuously having to learn how to play a better and better opponent

  • It's quite elegant, you know.

  • This is where we get to generative adversarial. Networks. Let's say

  • You've got a network you want to...

  • Let's say you want cat pictures

  • You know, you want to be able to give it a bunch of pictures of cats and have it

  • Spit out a new picture of a cat that you've never seen before that looks exactly like a cat

  • the way that the generative

  • adversarial network works is it's this architecture where you actually have two networks one of the networks is the discriminator

  • How's my spelling?

  • Yeah, like that

  • The discriminator Network is a classifier right it's a straightforward classifier

  • You give it an image

  • And it outputs a number between 0 & 1 and your training that in standard supervised learning way

  • Then you have a generator and the generator

  • Is...

  • Usually a convolutional neural network, although actually both of these can be other processes

  • But people tend to use in your networks for this.

  • And the generator, you

  • give it some random noise, and that's the random,

  • that's where it gets its source of randomness, so

  • That it can give multiple answers to the same question effectively.

  • You give it some random noise and it generates an image

  • From that noise and the idea is it's supposed to look like a cat

  • So the way that we do this with a generative adversarial Network is it's this architecture whereby you have two networks

  • Playing a game

  • Effectively it's a competitive game. It's adversarial between them and in fact

  • It's a very similar to the games we talked about in the Alpha go video.

  • it's a min/max game

  • Because these two networks are fighting over one number

  • one of them wants the number to be high one of them wants the number to be low.

  • And what that number actually is is the error rate of the discriminator?

  • so

  • The discriminator

  • Wants a low error rate the generator wants a high error rate the discriminators job is to look at an image

  • which could have come from the original data set or

  • It could have come from the generator and its job is to say yes. This is a real image or no. This is a fake

  • any outputs a number between 0 & 1 like 1 for its real and 0 for its fake for example and

  • the generator

  • Gets fed as its input. Just some random noise and it then generates an image from that and

  • it's

  • Reward you know it's training is

  • Pretty much the inverse of what the discriminator says