fenformer
Reads the piece placement (FEN) of a physical chess board from one photo. A DINOv2 ViT-B/14 encoder with four fused depths and 64 learned square queries, 92 M parameters, trained mostly on procedural renders. Code, training and evaluation: github.com/Ruichu-Xia/fenformer.
Use
git clone https://github.com/Ruichu-Xia/fenformer && cd fenformer
uv sync
uv run python -m fenformer.predict board.jpg # fetches fenformer.safetensors from this repo
The file is a plain FENFormer state dict in float32. The code pins it by commit and
SHA-256 (12a6de0931fe97b74a7c673499d4a97c8b749ba12a3b95c89f2221bc76c746c0).
Results
Exact-board accuracy (all 64 squares right), 95% Wilson intervals, constrained decoding:
| Benchmark | Images | fenformer |
|---|---|---|
| ChessCog transfer (unseen set) | 29 | 100% [88.3, 100] |
| samryan-500 (unseen set, top-down) | 500 | 30.2% [26.3, 34.4] |
| ChessReD test | 2,129 | 99.30% [98.8, 99.6] |
| ChessCog test | 342 | 95.32% [92.5, 97.1] |
Training data
61,879 images: 51,000 procedural renders over Lichess positions, plus the official
training splits of ChessReD (CC BY-NC-SA 4.0) and ChessCog. Because ChessReD is licensed
for non-commercial use, treat these weights as non-commercial. Full provenance is in the
code repository's docs/data.md.
Limitations
The training cameras stop at 75ยฐ elevation. On straight-down photos the model often reads bishops and rooks as pawns; see "Where it fails" in the code repository.