00:00:00
[Music]
00:00:08
all right welcome back to the second
00:00:11
lecture on eigenvalues and eigenvectors
00:00:14
and in particular
00:00:15
what i want to
00:00:16
talk about is this a demonstration of
00:00:19
the power of eigenvalues and
00:00:21
eigenvectors through an application i'm
00:00:23
going to call eigenfaces it's one of the
00:00:25
very interesting early applications in
00:00:28
some sense of data science and
00:00:29
understanding the power
00:00:32
of using
00:00:33
representations of data or features of
00:00:36
data to be able to make some actionable
00:00:39
decisions and machine intelligence
00:00:41
decisions and so this really started
00:00:43
very early on and this eigenface
00:00:45
application i want to talk about
00:00:47
it does two things first it starts to
00:00:49
generalize our concept of what we're
00:00:52
going to be thinking about in terms of
00:00:55
uh
00:00:56
matrices themselves so far we've been
00:00:58
thinking about it for this course in
00:01:00
terms of the matrices represent systems
00:01:02
of equations or something that comes out
00:01:04
of a physics-based model but here we're
00:01:06
going to start thinking about matrices
00:01:07
just being collections of data and what
00:01:10
does an eigenvalue an eigenvector for
00:01:12
that data mean
00:01:13
so uh more notes and a link to the class
00:01:16
website is here so just below in the
00:01:18
description you can hit that
00:01:20
link and you'll go to the class website
00:01:23
where you'll see a broader range of
00:01:25
lectures as well as notes data code
00:01:27
everything you need for this class
00:01:31
okay
00:01:32
so let's get to it so what i want to
00:01:36
talk about with eigenfaces and
00:01:37
eigenvalues is first i want to do is i
00:01:40
want to bring in an image i want to
00:01:42
bring in an image
00:01:44
that is typically in pixel space and
00:01:46
then i want to convert it into
00:01:48
a vector is what i really would like to
00:01:51
do and so here's some code both in
00:01:53
python and matlab and encode matlab
00:01:56
python this is going to find it on the
00:01:58
website
00:01:59
these are some important features that
00:02:01
we might
00:02:02
import from python in order for us to
00:02:06
bring in images and to start thinking
00:02:08
about as images as vectors
00:02:11
so for instance here once i've got all
00:02:13
of this
00:02:14
these packages loaded i would say
00:02:16
friends here f1c this is going to be a
00:02:19
picture of
00:02:20
roger federer for instance
00:02:22
uh is the first picture of roger federer
00:02:25
in color so that's what the f1 c stands
00:02:27
for first federal picture in color
00:02:30
i use the i am read command image read
00:02:32
command so image dot image read
00:02:35
one fed1.jpeg so it goes and in the file
00:02:38
this folder pulls in this jpeg image
00:02:41
and once you've pulled in this jpeg
00:02:43
image
00:02:44
normally what happens it's in pixel
00:02:46
space so it has that representation
00:02:49
and since it's a color figure it also
00:02:52
has an rgb representation in other words
00:02:54
each color picture has a red green green
00:02:57
and blue pixel designation and so really
00:03:00
what this is is the number of pixels in
00:03:03
the x and the y direction plus three
00:03:05
layers of of colors so it's it's
00:03:09
basically
00:03:10
it's a generalization of a matrix to
00:03:12
what's called a tensor it's a collection
00:03:14
of data which is a data cube in some
00:03:17
sense right so it's got thickness 3
00:03:20
which is the rgb along with pixels and x
00:03:22
and pixels and y
00:03:23
but what i'm going to do with this is i
00:03:25
just want to use it as a matrix
00:03:28
and so what i do is use the command rgb
00:03:30
to gray which turns it from color to
00:03:33
grayscale and so once i've done this now
00:03:36
i've flattened this down and i can even
00:03:39
resize it so if i've got a bunch of
00:03:41
figures and i want to make them a
00:03:42
standard number of pixels i've resized
00:03:44
this to 120 by 80 pixels so that allows
00:03:48
you to do this resize which allows us
00:03:51
now to work in a common framework across
00:03:53
all of our images because they're all be
00:03:55
the same size
00:03:58
i can also do this in matlab
00:04:00
but
00:04:01
again i am read image read command here
00:04:03
it is here's a picture of let's say
00:04:05
cloney
00:04:07
jpeg so i have a picture of george
00:04:09
clooney here i'll just show you in a
00:04:10
minute and i pull this in
00:04:13
i can do the same command rgb to gray
00:04:15
here it is so it's going to convert it
00:04:17
from a color map
00:04:19
which is has the red green blue
00:04:20
designation down to just a grayscale
00:04:23
and then
00:04:24
normally when you're in picture frames
00:04:26
or picture uh pictures have a very
00:04:29
different
00:04:30
representation in terms of what the
00:04:33
numbers mean and so
00:04:34
the double command turns it now to
00:04:36
double precision numbers so now i can do
00:04:38
math with it so for instance if i find
00:04:40
eigenvectors and eigenvalues whereas if
00:04:42
i don't do this it's in a
00:04:45
format called uint8 which means it's a
00:04:48
bunch of integers that take values
00:04:49
between 1 to 255 and you can't do
00:04:54
standard matrix manipulations with these
00:04:56
numbers
00:04:58
finally i resize this just like i did
00:05:00
before i am resize
00:05:03
and i resize it to 120 by 80. so the
00:05:07
point of these two codes is very simple
00:05:09
how do i read in a piece of data which
00:05:12
in this case is an image
00:05:14
that i first turn it into a grayscale
00:05:16
and then i make it so that all the sizes
00:05:19
are the same 120 by 80. and so these two
00:05:22
pieces of code are sort of like starters
00:05:24
for you to be able to import images
00:05:27
because part of what we're going to do
00:05:28
is now start to manipulate images and
00:05:31
start understanding what eigenvalues and
00:05:34
eigenvectors mean in the context
00:05:36
of
00:05:37
face images
00:05:41
so
00:05:42
i have a code that does this i'm not
00:05:44
going to go through the code in detail
00:05:45
because you can download it off of the
00:05:47
website but here for instance are a set
00:05:50
of pictures and i have very few pictures
00:05:52
actually normally when you want to do
00:05:54
something like this you'd want to do
00:05:56
a large number of pictures with a lot of
00:05:58
data but for the purposes of showing
00:06:01
some of the important features of what
00:06:02
we're going to be looking at this will
00:06:04
do just fine okay
00:06:06
so what you're seeing here is in the top
00:06:08
row i have five pictures and this is
00:06:10
george clooney here you go so five
00:06:12
pictures notice that i've cropped the
00:06:14
face roughly the same for all of these
00:06:16
images
00:06:17
the second row i have barack obama there
00:06:20
we go five pictures notice that there's
00:06:22
quite a diverse set of backgrounds
00:06:24
behind these faces right some are some
00:06:27
are dark some are light
00:06:29
in either case so i've got the the face
00:06:32
pretty well centered in the frame
00:06:34
uh margaret thatcher is here okay and
00:06:37
again mostly these faces are looking
00:06:40
head-on into the camera however there
00:06:42
are some slight turns of the head um
00:06:45
which are good and then matt damon here
00:06:48
we go matt damon is right down here five
00:06:50
pictures of matt damon so what i'm going
00:06:52
to do with this is i'm going to take
00:06:54
each one of these images
00:06:56
which is i've down scaled them to 120
00:06:58
pixels
00:07:00
in this direction 80 in this direction
00:07:03
so it's 120 by 80 for each one of these
00:07:06
pixel pictures and what we're going to
00:07:07
do is start to use eigenvectors and
00:07:10
eigenvalues to start to identify for us
00:07:13
common features
00:07:15
in images
00:07:16
uh and right away a couple things i want
00:07:18
to highlight to you
00:07:20
so we're here looking at these images
00:07:22
and again i've already said it's 120 by
00:07:25
80. what we're going to do with each one
00:07:27
of these images is we're going to turn
00:07:29
them into a vector so we're going to
00:07:31
think about 120 by 80 being there are 80
00:07:34
columns here
00:07:35
and so we can take those 80 columns and
00:07:37
stack them up on top of each other into
00:07:39
a very long skinny vector
00:07:42
or we can lay it across as a large row
00:07:44
vector this is called data flattening so
00:07:48
this is done commonly for many data
00:07:50
sources in which you have
00:07:52
various
00:07:54
things that you measure for instance
00:07:55
here this is the pixel space in x and y
00:07:58
i could also take the rgb cube but data
00:08:00
flattening takes all of these things and
00:08:02
just takes them reshapes whatever tensor
00:08:06
you have
00:08:07
into
00:08:08
a large vector
00:08:11
test test okay
00:08:15
so
00:08:16
that's what we're going to do to collect
00:08:18
this data and here i have 20 images
00:08:21
which means i'm going to create 20
00:08:23
vectors
00:08:24
and because the 20 vectors are 120 by 80
00:08:27
each vector is going to be length 120
00:08:30
times 80.
00:08:31
okay so this is what we have as our data
00:08:34
this is going to com comprise our our
00:08:36
matrix a
00:08:39
by the way i could also look at this is
00:08:41
sort of an interesting just observation
00:08:43
which is i could take
00:08:45
all of these george clooney pictures
00:08:48
and i could average them so just add
00:08:50
them together divide by five because i
00:08:51
got five pictures same thing with obama
00:08:54
thatcher
00:08:55
and jason bourne and what you would find
00:08:59
is the following right so here are these
00:09:02
faces which are sort of their average
00:09:03
faces so i start here with clooney
00:09:05
there's obama
00:09:07
and already you can see that in fact you
00:09:10
can still see a lot of features here
00:09:13
and you can still recognize that person
00:09:15
even though the quality is pretty poor
00:09:18
so one of the questions that we always
00:09:19
ask is
00:09:21
so clearly there's something here that
00:09:24
your eye is using to make a recognition
00:09:27
decision about who these people are
00:09:30
even if i don't give you a high quality
00:09:32
picture you know who they are you could
00:09:34
label them because you know i'm working
00:09:36
with four different people and it's not
00:09:38
like you look here at george clooney and
00:09:40
think that's margaret thatcher in fact
00:09:42
it's pretty clear it's not or that you
00:09:44
look here and see uh matt damon or that
00:09:47
you think it's margaret thatcher or
00:09:49
clooney or obama you you look at it and
00:09:51
it's pretty clear that that's the matt
00:09:53
damon picture so despite the low quality
00:09:56
it's very easy for us to make these
00:09:58
recognition decisions and part of what
00:10:00
we want to get after here with
00:10:01
eigenvectors and eigenvalues is how do
00:10:04
we actually approach this to think about
00:10:06
ways
00:10:07
what are the features that we're
00:10:08
actually maybe going after here that
00:10:10
allow us to see
00:10:13
and make these identification decisions
00:10:16
so part of what we're going to do is
00:10:18
we're going to go ahead and start to do
00:10:20
an eigenvalue eigenvector analysis
00:10:23
of this data and the way we're going to
00:10:25
do it is we're going to take and arrange
00:10:27
these images into let's say a matrix b
00:10:29
and the matrix b is just going to be
00:10:31
each one of those images remember i have
00:10:33
20 images here and in general if you do
00:10:36
uh you know production level industrial
00:10:39
level
00:10:40
data analysis this is going to be
00:10:42
thousands millions tens of millions of
00:10:44
images
00:10:45
where you want to start understanding
00:10:46
the features between faces
00:10:49
but here we have 20 images which means
00:10:51
there's me 20 rows to this matrix first
00:10:53
i'm going to take the first image i'm
00:10:54
going to vectorize it as a row vector so
00:10:56
i'm going to take this thing and it's
00:10:58
going to be a row whose length is 120
00:11:00
times 80 long
00:11:02
that's how long this first row is and
00:11:04
let's say that's the first picture of
00:11:06
george clooney and then the second
00:11:07
picture of george clooney then i put
00:11:09
barack obama's margaret thatcher's matt
00:11:11
damon's all together
00:11:13
20 rows
00:11:15
which have 120 times 80 columns so
00:11:18
that's my data matrix
00:11:20
and i'm going to use that data matrix to
00:11:22
start doing analysis of faces and this
00:11:24
is again one of the earliest versions of
00:11:27
really doing some very interesting data
00:11:29
science and feature extraction from
00:11:32
matrices that we have
00:11:34
around around face recognition
00:11:39
so the big thing i'm going to do with
00:11:40
this matrix is create what's called a
00:11:42
correlation matrix i'm basically going
00:11:44
to take
00:11:46
that matrix b
00:11:48
transpose it multiply by itself and what
00:11:51
this is allowing me to do is start to
00:11:53
look at correlations among these vectors
00:11:57
what does it mean to have correlations
00:11:59
among the vectors
00:12:01
well if i take
00:12:03
one of those vectors which just say is
00:12:05
the case image
00:12:07
and i
00:12:08
take the inner product with the jth
00:12:10
image
00:12:11
if i take the inner product of those two
00:12:13
vectors
00:12:14
what i'm really looking at is their
00:12:16
correlation right so if the inner
00:12:19
product is zero
00:12:20
that means they have nothing to do with
00:12:22
each other and if they're normalized
00:12:24
vectors and if i take that inner product
00:12:26
and it's 1 that means i have a high
00:12:28
degree of correlation among them
00:12:30
so what this is actually allowing me to
00:12:32
do so notice how we've changed the
00:12:35
context of what's going on in that
00:12:36
matrix and that data when we take inner
00:12:39
products now and these projections are
00:12:41
telling us something about correlation
00:12:44
how are two different
00:12:46
columns
00:12:47
or rows in this case how are two
00:12:49
different rows of this matrix here
00:12:52
correlated with each other and i can get
00:12:54
that information by taking a dot product
00:12:57
and if that dot product is zero that
00:12:59
means they are orthogonally have nothing
00:13:01
to do with each other but if the dot
00:13:03
product is one and these let's say these
00:13:04
were normalized then they would mean
00:13:06
it's exactly the same image
00:13:08
so what you're looking at to see is how
00:13:10
does that dot product change across all
00:13:12
those faces not only how do george
00:13:15
clooney faces looks relative to each
00:13:16
other but how did george clooney faces
00:13:18
project or dot product with margaret
00:13:21
thatcher for barack obama or matt damon
00:13:24
so that's the kind of thing that we're
00:13:26
actually calculating here in the c
00:13:28
matrix as correlation
00:13:30
so now we've
00:13:31
turned our interpretation of this matrix
00:13:34
the matrix is data it's not solving some
00:13:37
3x3 system or solving for currents and
00:13:40
with resistors and so forth this is
00:13:42
actually just straight data and our
00:13:44
inner product tells us something about
00:13:46
correlations
00:13:49
so how do you do that in python or
00:13:52
matlab here are some basic code
00:13:54
structures to do that
00:13:55
so i
00:13:57
am going to import from numpy
00:13:59
from illinois called la because what
00:14:02
we're going to do is eigenvalue
00:14:03
decomposition i'm going to call it la is
00:14:05
going to be this linear algebra package
00:14:07
so i can just simply do v comma d so
00:14:10
first of all i compute i create the
00:14:12
matrix b and i already showed you how to
00:14:14
read in images and so now you take these
00:14:16
images you stack them on top of each
00:14:18
other to make the b and then a matrix
00:14:20
multiply b times b transpose
00:14:23
so that's matrix multiply and that
00:14:25
creates my correlation matrix c
00:14:27
and then i can actually find its
00:14:29
eigenvalues and eigenvectors just by
00:14:31
simply here's the eigenvectors here's
00:14:32
the eigenvacuumers by
00:14:34
la dot i so this is calling the linear
00:14:37
algebra package i could have just said
00:14:38
linalch dot i c or las ixc whichever one
00:14:43
but there's a little code structure for
00:14:44
doing it
00:14:45
and matlab
00:14:47
here you go c is
00:14:49
b times b and actually i think they have
00:14:52
this backwards this just should have
00:14:53
been just b times b transpose over here
00:14:55
apologies for that
00:14:57
okay and then you just use the x command
00:15:00
and you get back v and d now notice here
00:15:03
with i i'm actually doing something a
00:15:04
little more sophisticated than up here
00:15:06
which is i'm
00:15:08
taking it taking that matrix c putting
00:15:10
it in there
00:15:12
and what i'm doing is
00:15:13
i can ask i only want the top 20
00:15:16
eigenvalues
00:15:17
sorted by the largest magnitude so this
00:15:19
is a very simple statement which allows
00:15:22
me to
00:15:24
get eigenvalues and eigenvectors to this
00:15:27
in a very efficient way where i can
00:15:29
specify what i want which is the largest
00:15:31
magnitude and i only want 20
00:15:34
instead of all possible eigenvalues
00:15:36
eigenvectors you can do something
00:15:37
similar here in python as well but this
00:15:40
is the code structure for executing the
00:15:43
eigenvalues and eigenvectors
00:15:45
on this correlation matrix here okay and
00:15:48
like i said apologies that that prime
00:15:51
should have been over here
00:15:53
okay
00:15:55
so what do we get from this once we've
00:15:57
executed these i want to talk about the
00:16:00
interpretation
00:16:01
and what i'm showing you here
00:16:03
on this plot is i'm showing you five
00:16:08
these are five faces they look like
00:16:09
faces they look like very warped faces
00:16:11
in some sense or
00:16:13
kind of weird but what they are these
00:16:15
are eigenfaces so i got the eigenvector
00:16:19
which is of length 120 times 80. i
00:16:21
reshaped it back to 100
00:16:24
so it was length 120 times 80. now i've
00:16:26
reshaped it back to 120 by 80.
00:16:28
and this is the dominant eigenface
00:16:32
this is the second eigenface the third
00:16:34
eigenface so these are just eigenvectors
00:16:37
but these eigenvectors
00:16:39
remember their coordinate system
00:16:41
and in this coordinate system you start
00:16:43
to see the features
00:16:45
that we can use to do face
00:16:48
identification so let's talk about these
00:16:50
features the first feature is
00:16:51
interesting because what does it really
00:16:53
have for us if you look at this right
00:16:56
you see that what this first feature is
00:16:58
is sort of in some sense the most common
00:17:01
thing that all faces have
00:17:02
so first of all
00:17:04
it's round
00:17:06
or oblong
00:17:08
you got some eyes it has a little bit of
00:17:10
a feature of a mouth but then you really
00:17:12
you have this hair
00:17:14
face separation
00:17:15
so every single one of the faces i
00:17:17
showed you
00:17:18
there was clearly a feature where the
00:17:20
forehead ends to the hair
00:17:22
it has eyes and nose and mouth and this
00:17:25
here really picks up
00:17:27
a lot of that basic feature so
00:17:29
it's very hard to tell the difference
00:17:30
between any face because this is just a
00:17:33
common feature across all the faces
00:17:35
and in fact
00:17:37
what i'm showing you here on this
00:17:38
picture
00:17:40
is the eigenvalues and they're what the
00:17:42
actual values of these largest magnitude
00:17:44
eigenvalues are notice the first one
00:17:46
which is that one is much bigger than
00:17:48
the others so it's quite a bit bigger
00:17:50
look at this this goes to 10 to the 10.
00:17:52
the next one's at 10 to the 8. so this
00:17:55
is like two orders of magnitude bigger
00:17:57
than the others
00:17:58
okay so that tells you something
00:18:01
important about what this eigenvector is
00:18:03
picking up it's picking up these
00:18:05
dominant features that all faces have
00:18:09
the second eigenvector here it is
00:18:12
you can start to see a little bit more
00:18:14
of the eye structure ears mouth
00:18:17
same thing with the third the fourth and
00:18:19
the fifth and in fact one thing i want
00:18:21
to point out it's around the third
00:18:24
and the fourth that you start actually
00:18:26
starting to see some teeth remember that
00:18:28
out of those pictures originally there
00:18:30
was only about
00:18:32
four or five of the images where teeth
00:18:34
was shown so eventually teeth shows up
00:18:36
as one of the features in this thing so
00:18:39
the idea here is all those faces could
00:18:42
be represented as a linear combination
00:18:46
of these
00:18:47
features or these eigenvectors okay so
00:18:50
another way to think about this from the
00:18:52
data science perspective is this is now
00:18:55
a feature space
00:18:57
in this feature space we can start now
00:19:00
to represent any generic face because we
00:19:04
can take a new face
00:19:05
and project it onto these eigenvectors
00:19:08
to get some idea of how
00:19:11
some new face or new person's face would
00:19:14
project relative to the other faces that
00:19:17
we have here
00:19:18
okay
00:19:19
so it's kind of an interesting concept
00:19:21
we've turned this idea of an eigenvector
00:19:23
into a coordinate system and this is an
00:19:26
eigenface coordinate system it allows us
00:19:29
to start thinking about how could i use
00:19:31
this to do face identification or
00:19:35
you know person identification in fact
00:19:36
this is one of the earliest things that
00:19:38
we started thinking about for this and
00:19:40
this is all the way back in the late 80s
00:19:43
so in fact just to make this more
00:19:44
concrete
00:19:46
i'm going to take the average
00:19:49
clooney face obama face thatcher or matt
00:19:51
damon face
00:19:52
and what i'm going to do with this
00:19:54
is i'm going to take those average
00:19:56
their average phase which is the average
00:19:57
over the five and i'm going to project
00:19:59
it on to those first 20 eigenvectors so
00:20:03
here's what george clooney looks like
00:20:04
projected onto those
00:20:06
here is what obama looks like projected
00:20:09
onto those
00:20:10
here's what thatcher looks like on those
00:20:13
here's what matt damon looks like on
00:20:14
those and notice
00:20:16
these are quite different and this is
00:20:19
exactly what we can use
00:20:21
to start to do
00:20:23
a classification task which allows us to
00:20:26
identify clooney versus matt damon what
00:20:29
is the difference well look at matt
00:20:31
damon look at these very strong
00:20:33
signatures
00:20:35
positive and then negative on the first
00:20:38
five eigenvectors whereas clooneys have
00:20:40
a very different structure there
00:20:43
same thing with obama has very different
00:20:45
structure here very low representation
00:20:47
on the higher modes
00:20:49
thatcher has something different so in
00:20:50
other words each one of these are like
00:20:52
keys
00:20:53
they're like
00:20:54
a key for representing one of these
00:20:57
faces so if i gave you a new face
00:21:02
uh and i didn't tell you if it was
00:21:04
george clooney or margaret thatcher
00:21:06
or barack obama or matt damon i just
00:21:08
gave you a face and i said okay i want
00:21:10
your computer to tell me
00:21:12
whose face this is
00:21:14
what you would do is you would take that
00:21:16
face
00:21:17
take it as a 120 by 80 image you would
00:21:19
take
00:21:20
you would reshape it take its inner
00:21:23
product on the first 20 eigenvectors for
00:21:25
instance and you would look to see does
00:21:27
it look more like this like this like
00:21:29
this or like this
00:21:31
and whichever one it looked most like
00:21:33
you would then make a classification
00:21:35
decision and say i think that's matt
00:21:37
damon because
00:21:38
when i project the face it looks most
00:21:40
like this set of weights onto the
00:21:44
eigenvectors remember we're all
00:21:46
projecting onto these eigenvectors which
00:21:49
is the feature space which are given
00:21:50
right by here i've only shown you the
00:21:52
first five but i can take the first 20.
00:21:55
okay and so this becomes a really
00:21:58
interesting concept
00:22:00
for
00:22:01
doing face recognition this is like i
00:22:03
said one of the earliest versions of
00:22:05
this was just saying let's just use
00:22:07
eigenvectors and eigenvalues as a
00:22:10
coordinate system
00:22:11
and it does a remarkable job in getting
00:22:14
you information about this and that
00:22:16
really started off this trend of
00:22:18
thinking about like wait a minute we can
00:22:19
use
00:22:20
a lot of these linear algebra methods
00:22:23
to build pretty sophisticated tools for
00:22:26
face recognition and of course in the
00:22:28
last decade or so that has all moved
00:22:30
towards deep learning but the concept of
00:22:32
a feature space
00:22:34
still exists there and this is really
00:22:37
what set down
00:22:38
the basis of understanding how to do
00:22:41
face recognition with this idea of a
00:22:44
feature space
00:22:47
so
00:22:47
let's continue on this little fun little
00:22:49
exercise and i'm going to go ahead and
00:22:52
take a picture for instance here's one
00:22:54
of the pictures in the training data set
00:22:56
this is margaret thatcher
00:22:58
and uh
00:23:00
actually i think i believe this was a
00:23:01
new image of margaret thatcher not in my
00:23:04
five that i contained or so i built this
00:23:07
right i took 20 pictures
00:23:09
i built this thing out and what i did is
00:23:11
i said let me take a new picture of
00:23:13
margaret thatcher let's project this new
00:23:16
picture on to the eigenvectors and
00:23:18
here's what i get
00:23:19
and what i could do is saying hey let's
00:23:21
try to reconstruct margaret thatcher
00:23:24
this picture in terms of this
00:23:26
eigenvector basis and notice what it
00:23:28
does it actually
00:23:29
gives you back a face that kind of looks
00:23:31
like margaret thatcher in fact i can
00:23:33
look at the error of this new face
00:23:37
against her five pictures and here's
00:23:39
where they are and so for instance one
00:23:41
of them is very close to one of the
00:23:43
pictures there so this is kind of an
00:23:45
interesting concept new new picture i
00:23:48
projected onto eigenvectors and actually
00:23:50
what i get out is something that looks
00:23:53
pretty similar to
00:23:55
uh
00:23:56
you know roughly it looks like margaret
00:23:57
thatcher
00:23:59
i can also take meryl streep here and
00:24:02
meryl streep played margaret thatcher in
00:24:04
the iron lady this was a movie i think
00:24:06
she was nominated for academy award of
00:24:08
course as usual and we could take her
00:24:11
projected onto margaret thatcher and
00:24:14
here's what we get it's actually quite
00:24:16
different than here and so part of what
00:24:17
you're doing is saying how does her
00:24:19
likeness
00:24:20
playing market thatcher actually stack
00:24:22
up to images of margaret thatcher and so
00:24:24
if i reconstruct with these onto the
00:24:28
eigenvectors i have
00:24:30
i get something that doesn't look like
00:24:31
margaret thatcher very much and in fact
00:24:33
the error between
00:24:35
this her representation and the other
00:24:37
pictures are quite large compared to
00:24:40
they can be pretty small
00:24:41
in the uh
00:24:43
with this other picture of margaret
00:24:45
thatcher finally i take hillary rodham
00:24:47
clinton there we go project onto here
00:24:50
and again she does not look
00:24:52
a whole lot like margaret thatcher
00:24:54
but she does look more like margaret
00:24:56
thatcher than
00:24:59
than we do
00:25:00
with uh with our representation of
00:25:03
cinema uh
00:25:05
uh
00:25:06
here as as someone playing margaret
00:25:09
thatcher so anyway these are kind of fun
00:25:11
games you can play
00:25:12
uh with these representations and again
00:25:17
it's all like coming down to
00:25:19
project onto this feature space which
00:25:21
are the eigenfaces and starting to
00:25:24
understand how the eigenfaces
00:25:27
really help us understand to do face
00:25:29
recognition whether i'm looking at meryl
00:25:31
streep or hillary rod and clinton how
00:25:33
they project how much do they look like
00:25:36
margaret thatcher versus a picture of
00:25:38
margaret factor i never had
00:25:40
and i project onto this
00:25:43
my little final example of this is i is
00:25:46
me
00:25:47
i take a picture of me there's my face
00:25:49
and i say i'm going to project myself
00:25:51
onto these 20 eigenvectors so there's my
00:25:54
projection onto the 20i vectors and if i
00:25:57
reconstruct myself in that 20
00:25:59
eigenvector space
00:26:00
here is my representation okay
00:26:03
and who do i look most like
00:26:06
i was kind of going to try to figure out
00:26:07
i was hoping i would look most like
00:26:09
super handsome george clooney but it
00:26:11
turns out
00:26:12
i don't what i look mostly like and you
00:26:16
could probably tell from the suit and
00:26:17
tie
00:26:18
i look very presidential so here's obama
00:26:21
and my best projection are on to obama
00:26:23
pictures
00:26:24
and then here's clooney i leak look
00:26:27
least like
00:26:28
thatcher and then i don't look too much
00:26:30
like matt damon except for one picture
00:26:32
of me of one picture of matt damon
00:26:34
that's probably when he was super
00:26:35
awesome jason bourne because probably i
00:26:38
probably look like something like that
00:26:39
you probably think i'm jason bourne
00:26:40
right so there we go presidential jason
00:26:43
bourne with a little bit of superheroes
00:26:46
from clooney that's
00:26:47
that'd be a nice way to think of oneself
00:26:50
but this is all using these concepts of
00:26:53
feature spaces to build out
00:26:56
really interesting representations of of
00:27:00
of ourselves of images and really
00:27:03
i think highlighting for us the role of
00:27:06
eigenvectors and eigenvalues in creating
00:27:08
a coordinate system in this case
00:27:11
the eigenphase coordinate system so
00:27:13
hopefully this has been a little fun
00:27:15
little uh
00:27:16
exercise and seeing the kind of things
00:27:18
you can do and again it comes down to
00:27:20
this concept of the eigenvalue and
00:27:22
eigenvector which are these very broad
00:27:24
general representation tools which are a
00:27:27
coordinate transformation into which
00:27:30
things become diagonalizable
00:27:32
and the eigenvectors themselves are
00:27:35
features here the features were these
00:27:38
eigenfaces but more generally in physics
00:27:41
based problems these eigenvectors become
00:27:44
these
00:27:45
in some sense the best coordinate system
00:27:47
for you to use for that system so that's
00:27:50
something we're going to keep building
00:27:51
on you'll keep seeing eigenvalues
00:27:53
eigenvectors all the time throughout
00:27:54
physics and engineering here i took it a
00:27:57
little bit different direction with
00:27:58
eigenfaces but really mostly for the
00:28:01
point of view to just highlight how
00:28:03
powerful a concept this is
00:28:05
if you want to download the data and
00:28:07
code for this it's all on the website
00:28:10
here you can click on the link on the
00:28:12
description of this page you get the
00:28:15
notes data everything you need and you
00:28:18
can play around with this when it's kind
00:28:19
of a fun little thing to play around
00:28:21
with
00:28:23
[Music]
00:28:30
you