A Pytorch re-implementation of the original paper with training and testing on the custom face dataset to determine facial similarities.
Siamese Neural Networks take two samples as input and outputs a probability for whether given inputs belong to the same class or not. Input samples pass through identical CNNs (with shared weights), and their embeddings are compared in the cost function. Here, a contrastive loss function is used to find the similarity between the image pair. Its formula is (Y - label, Dw - euclidian distance, m - margin):