In this lecture we are going to summarize everything we learned in this section of the course.
This section was all about facial recognition with Siamese networks.
One thing you saw in this section was that while the theory was relatively simple the implementation
was complex not because of the model itself but because of all the data processing Siamese that works
by themselves are quite simple.
We passed two images through the same CNN and this gives us a face embedding for both images.
Then we would like to know the distance between these two embedding is just like we do with word embedding
meetings that tell us how similar the two faces are if the two faces are so similar that the distance
between the embedding is less than some threshold and we predict that they are the same person.
If the faces are from different people the distance between the embedding should be greater than the
threshold so that we can predict that they are different people in reality.
Suppose you are running some kind of facial recognition database at your company instead of always passing
in two faces at a time something simpler you could do is just store the embedding themselves in a database.
So for all the employees of the company or all of the students in a school don't store their images
just store there and then things then when it's prediction time you only have to calculate the embedding
for the incoming image and compare that to all the existing embedding in your database to determine
which person it is.
Next we looked at all the data pre processing steps of which there were many.
First we loaded in the data and split the images up into train and test.
It was important to realize that the data being fed into the neural network itself not be split up but
rather we should split up the images to start with.
This is so that none of the images in the train set will appear in the test set and this is because
the actual data set we train the neuron that recon simply consists of the same images being paired up
amongst themselves multiple times.
We don't start with a lot of images but we end up with a lot of training samples which grow quite dramatically
with the number of images we have.
Next we looked at how to convert the data into pairs.
There are many ways of doing this and sometimes it can be difficult to try and understand what someone
else's approach is.
So as always the most important thing is to coat it up yourself.
This always leads to the best understanding next.
We wrote some data generator functions so that we could iterate over these in our training loop to generate
data on the fly and not have to store them in gigantic Redundant Arrays.
Finally we wrote a function to help us evaluate the Siamese networks.
In particular it would draw a histogram of the match distances versus the non match distances and prints
out the sensitivity and specificity.
This is better than accuracy because we have imbalanced classes due to the nature of the data.
We will always have more samples from the negative class than the positive class.