Hi and welcome back.
Now that you have an intuitive understanding, at least at a high level of how some these networks work
and what they're used for, we can now talk about how you can begin training your very ordered society,
its network.
So let's get started.
So firstly, let's do a quick recap.
Remember, the goal of a socialist network is to classify what two inputs like these two images here
are similar or not.
And to do that, we have to basically create an including using the kind of layers of identical networks
here and here.
And then we can use those in a different single layer to compare them using Euclidean across St. Louis.
And then we use a loss function here to output a similarity score.
So in order to Trina, a Siamese network, we basically have to create appeared dataset.
Basically, I'll explain what that is to you.
We firstly start by creating image pairs.
So what is the image?
Because, well, firstly, we need to create pairs where the images are identical, like a positive
pair here.
And then also when they are negative, when there are different classes.
So we can see they're in the same class here, but there are different classes here.
So this pier becomes a dataset when this is a label here.
And likewise, this is the pier we are treating it on.
And this is label quite simple, isn't it?
So let's talk about how we build this network, so we build and see another that outputs a feature encoding
or embedding later using a fully connected layer at the end.
That's a densely and gives you forgot.
We build it the system network, which will have the exact same architecture and hyper parameters and
widths as the initial CNN we created here.
We didn't build a different layer to calculate the Euclidean distance or cosine distance between the
output of the Tunisian and sub networks.
The final here is a fully connected layer with a single node using a sigmoid activation function to
output similarity score.
And lastly, we compiled a model using one of the lowest functions we discussed contrastive triplet
or binary.
However, I would stick to contrastive or triplet in most cases.
And then you're basically ready to train once we have our image data set as a sorted in pairs and we
have all models built and compiled.
We can then use something like a typical optimizer, like R-Miss. proper common gradient descent algorithm,
and we can start training with CNN's No.
There are typically quite simple and we do not need to, as do we need to create relatively simple embeddings,
meaning that like, let's say, we're including these images here.
This is a 28 by 28 image you can use of maybe the code 64 one dimensional vector.
So one by 64 to store those embeddings or something even smaller if you want, it will work.
However, if you get too small, you lose some information in the network.
So I would advise you maybe stick to like 64 128 foot image this size.
So that's it.
You're basically ready to trim Siamese network right now.
But let's take a look at how we do that increase.
So stay tuned for that lesson.
Thank you.