Skip to content

My implementation of Siamese Network for MNIST Dataset in Pytorch and Tensorflow

Notifications You must be signed in to change notification settings

07Agarg/Siamese_Network

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Siamese_Network

This repository contains Siamese Network for MNIST DATASET.

DESCRIPTION:

In Siamese Networks, we take an input image of a person and find out the encodings of that image, then we take the same network without performing any updates on weights and biases and feed this network an input image of a different person and again predict it's encodings. Now we compare these two encodings to check whether there is a similarity between the two images. These two encodings act as a latent feature representation of the images. Images with the same person have similar features/encodings. Using this, we compare and tell if the two images have the same person or not.

DATASET:

This network is tested on simplest MNIST DATASET, a large database of handwritten digits that is commonly used for training various image processing systems. It contains 60,000 training images and 10,000 testing images.

The dataset is available in both Tensorflow and PyTorch. Tensorflow loads the dataset in Numpy arrays whereas PyTorch APIs loads the same dataset in Torch Tensors.

NETWORK DETAILS:

3-layer fully connected neural network with shared weights.

REQUIREMENTS:

The repository contains both PYTORCH and TENSORFLOW models .

  • Python 3.6
  • Tensorflow 1.10.0 / PyTorch 0.2.1

LOSS:

Tensorflow Output:
Training Data:
Epoch: 48500 Loss: 0.075
Epoch: 49000 Loss: 0.095
Epoch: 49500 Loss: 0.053

PyTorch Output:
Training Data:
Epoch: 48500 Loss: 0.054
Epoch: 49000 Loss: 0.068
Epoch: 49500 Loss: 0.051

RESULT:

Tensorflow: Tensorflow Output Image

PyTorch: PyTorch Output Image

REFERENCES:

For Visualization, I used the code of the following repo: https://github.com/ywpkwon/siamese_tf_mnist/blob/master/visualize.py

About

My implementation of Siamese Network for MNIST Dataset in Pytorch and Tensorflow

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages