Siamese · Omniglot · PyTorch

Siamese Networks for One-Shot Learning

PyTorch reimplementation on the Omniglot dataset

One-shot learning system

Twin encoders, one-shot decisions.

A compact Siamese PyTorch implementation trained on Omniglot, with a clear path from paper to runnable code.

Run the project

Quick Start

Prepare Omniglot, create the model directory, and launch training with the provided script.

git clone https://github.com/brendenlake/omniglot.git
cd omniglot/python
unzip images_evaluation.zip
unzip images_background.zip
cd ../..
mkdir models
python3 train.py --train_path omniglot/python/images_background \
                 --test_path omniglot/python/images_evaluation \
                 --gpu_ids 0 \
                 --model_path models

Implementation notes

Why the result differs from the paper

Optimizer choice

This implementation uses Adam instead of SGD with momentum.

Parameter settings

The code keeps default PyTorch initialization and shared settings instead of layer-specific tuning from the paper.

Experiment artifact

Training curve

The repository includes a sampled loss curve collected during training.

Training loss curve for the Siamese network.