Add an optional eight-way mirrored-print model, offline CLI and evaluated operating points
5c3729a verified Download training/network.py from foliokestrel/folio-orient: direct link, hf CLI and curl.
- Browser
- Download file 784 Bytes
-
https://huggingface.co/foliokestrel/folio-orient/resolve/main/training/network.py
- Command line
-
hf download hf://foliokestrel/folio-orient/training/network.py
-
curl -L -o network.py https://huggingface.co/foliokestrel/folio-orient/resolve/main/training/network.py
784 Bytes
| """Classify a print patch by its correcting quarter-turn and optional reflection.""" | |
| from torch import nn | |
| class PatchOrient(nn.Sequential): | |
| def __init__(self, classes=4): | |
| layers = [] | |
| previous = 1 | |
| for channels in (16, 24, 48, 64): | |
| for stride in (2, 1): | |
| layers.extend( | |
| [ | |
| nn.Conv2d( | |
| previous, channels, 3, stride=stride, padding=1, bias=False | |
| ), | |
| nn.BatchNorm2d(channels), | |
| nn.ReLU(), | |
| ] | |
| ) | |
| previous = channels | |
| super().__init__( | |
| *layers, nn.AdaptiveAvgPool2d(1), nn.Flatten(), nn.Linear(previous, classes) | |
| ) | |