Project documentation

Siamese Project Docs

Architecture, data pipeline, training flow, and repository map.

Overview

What this repository implements

This project is a compact PyTorch reimplementation of Siamese Networks for One-Shot Learning. It targets the Omniglot dataset, trains a twin-branch image encoder, and evaluates performance with a 20-way one-shot matching setup.

Primary goal

Learn whether two handwritten character images belong to the same class.

Reported result

The current implementation reports around 89.5% final accuracy, slightly below the original paper's 92%.

Docs map

Navigate by implementation boundary

Architecture chapter

Covers the Siamese encoder structure, embedding path, absolute-difference scoring, and the reasoning behind the final binary logit.

Dataset chapter

Explains how Omniglot samples are loaded, rotated, paired, and assembled into one-shot evaluation episodes.

Training chapter

Walks through flag parsing, loaders, optimization, checkpointing, test-time precision measurement, and produced artifacts.

Repository map

What each core file is responsible for

model.py

Defines the Siamese neural network, including the shared convolution tower, the 4096-dimensional projection layer, and the final similarity logit.

mydataset.py

Implements the in-memory Omniglot training and testing datasets, pair sampling logic, image rotation augmentation, and one-shot evaluation episode layout.

train.py

Owns flag parsing, dataloader construction, optimizer setup, training loop, periodic evaluation, checkpoint saving, and final accuracy aggregation.

readme.md

Provides the original quick-start instructions, requirement list, experiment summary, and the implementation differences relative to the paper.