A working example - MNIST
The working example is based on the Github page: https://github.com/ywpkwon/siamese_tf_mnist. This code here uses Siamese Networks to embed hand-written MNIST digits into 2D space, digits belonging to same class are embedded together. The code consists of three major files:
● run.py: It contains the basic wrapper to perform training. It uses the Gradient Descent algorithm to minimize the contrastive loss.
● inference.py: This contains the Siamese Class which defines a 3-layered fully connected network. The similarity between the output of two networks in the code is Euclidean. The partial generative loss and the partial imposter Loss are used to then to calculate the Contrastive loss.
● visualize.py: This is again ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access