In-memory cache
`loadToMem` walks the full training tree once and stores PIL images in memory, reducing repeated disk access during long training runs.
Dataset chapter
In-memory loading, rotation augmentation, pair sampling, and one-shot episodes.
Module boundary
The repository uses two custom dataset classes: `OmniglotTrain` for endless pair sampling during optimization and `OmniglotTest` for one-shot evaluation episodes.
Training dataset
`loadToMem` walks the full training tree once and stores PIL images in memory, reducing repeated disk access during long training runs.
Each class is duplicated at 0, 90, 180, and 270 degrees, effectively turning orientation variants into extra class identities.
Sampling logic
Odd indices sample two images from the same class and return label `1.0`.
Even indices sample images from different classes and return label `0.0`.
The training path applies random affine augmentation before `ToTensor`, which injects mild shape variation into each sampled pair.
Evaluation dataset
Index `0` in each episode creates the anchor image and a true match. The remaining `way - 1` entries are distractor classes.
The training loop treats prediction as correct only when the maximum score in the episode lands on the first pair, which is the true match.