/one-shot-siamese

A PyTorch implementation of "Siamese Neural Networks for One-shot Image Recognition".

Primary LanguageJupyter Notebook

Siamese Networks for One-Shot Learning

Drawing

Paper Modifications

I've done some slight modifications to the paper to eliminate variables while I debug my code. Specifically, validation and test accuracy currently suck so I'm checking if there's a bug either in the dataset generation or trainer code.

  • I'm using Relu -> Maxpool rather than Maxpool - Relu.
  • I'm using batch norm between the conv layers.
  • I'm using He et. al. initialization.
  • I'm using a global learning rate, l2 reg factor, and momentum rather than per-layer parameters.

Omniglot Dataset

Drawing Drawing Drawing

Execute the following commands

  • Download the data using run.sh
    • chmod +x run.sh
    • ./run.sh
  • Process the data using data_prep.ipynb

Then, you can load the dataset using:

from data_loader import *

# batch size of 32 with data augmentation
train_loader, valid_loader = get_train_valid_loader(data_dir, 32, True)

for idx, (x, y) in enumerate(train_loader):
    # do something

Checkout Playground.ipynb for a minimal working example.