Per-square chess piece classifier used as the perception front-end of an SO-101 chess-playing robot pipeline. Code:
Fonte do modelo
Descrição da fonte
Per-square chess piece classifier used as the perception front-end of an SO-101 chess-playing robot pipeline. Code: https://github.com/emil-332/vla-implementations
It runs as two small CNNs over per-square crops, following chesscog (Wölflein & Lange, 2021):
Fontes
1 fonteVerificado 17 de set.
Artefatos de modelo
4 artefatosTrechos de fonte
2 trechos{white,black}_{pawn,knight,bishop,rook,queen,king}),
144x96 crop with upward padding to include the piece above its square.Squares are cut from a side/oblique camera over a homography-grounded grid, run through occupancy, then identity on the occupied squares, and assembled into a board state.
| File | What |
|---|---|
occupancy.onnx / piece.onnx | inference models (onnxruntime, dynamic batch) |
occupancy.pt / piece.pt | PyTorch checkpoints (warm-start for fine-tuning) |
piece_cnn.yaml | architecture/config (backbones, crop sizes, normalization) |
Inputs are ImageNet-normalized N x 3 x H x W float32 (RGB/255 then mean/std).
10.17605/OSF.IO/XF3KA), ~4,400 rendered
boards for training.Held-out chesscog validation split, per square:
| Stage | Accuracy |
|---|---|
| Occupancy | 0.9994 |
| Piece identity | 0.9963 |
These are in-distribution numbers on chesscog's Staunton pieces.
This is a base model. It does not transfer to a different physical piece set
out of the box. For a custom board (e.g. 3D-printed pieces), few-shot fine-tune
from the .pt checkpoints on a handful of side-camera photos of the starting
position (see the repo's docs/perception_piece_cnn.md, train_piece_cnn.py --init-dir). It assumes the board is already grounded (4 corners + homography);
it does not detect the board itself.
from chess_robot.perception.piece_cnn_config import load_two_stage_config
from chess_robot.perception.piece_cnn_onnx import OnnxTwoStageClassifier
config = load_two_stage_config("piece_cnn.yaml")
classifier = OnnxTwoStageClassifier.from_paths(config, "occupancy.onnx", "piece.onnx")
board_state = classifier.classify(frames, grounded_grid) # -> BoardState
Or end to end via scripts/run_perception.py in the repo.
Code is under the repository's license. The model is derived from the chesscog synthetic dataset; consult the chesscog project for that dataset's terms before redistribution. Update this field to the license you intend.
piece.onnx
onnx · 81,2 MB · SHA-256 57e92c1a54e6…f599 · Hugging Face
--- license: other tags: - chess - computer-vision - image-classification - onnx - robotics --- # Two-stage chess piece classifier (chesscog pretrain) Per-square chess piece classifier used as the perception front-end of an SO-101 chess-playing robot pipeline. Code: https://github.com/emil-332/vla-implementations It runs as two small CNNs over per-square crops, following chesscog (Wölflein & Lange, 2021): 1. **Occupancy** — ResNet-18, binary (empty vs occupied), 100x100 near-square crop. 2. **Identity** — ResNet-34, 12 classes (`{white,black}_{pawn,knight,bishop,rook,queen,king}`), 144x96 crop with upward padding to include the piece above its square. Squares are cut from a side/oblique camera over a homography-grounded grid, run through occupancy, then identity on the occupied squares, and assembled into a board state. ## Files | File | What | |---|---| | `occupancy.onnx` / `piece.onnx` | inference models (onnxruntime, dynamic batch) | | `occupancy.pt` / `piece.pt` | PyTorch checkpoints (warm-start for fine-tuning) | | `piece_cnn.yaml` | architecture/config (backbones, crop sizes, normalization) | Inputs are ImageNet-normalized `N x 3 x H x W` float32 (RGB/255 then mean/std). ## Training - Data: chesscog synthetic dataset (OSF `10.17605/OSF.IO/XF3KA`), ~4,400 rendered boards for training. - Recipe: ImageNet-pretrained backbones, two-phase fine-tune (new head, then the whole network at a lower learning rate). - Hardware: single RTX GPU (vast.ai). ## Evaluation Held-out chesscog validation split, per square: | Stage | Accuracy | |---|---| | Occupancy | 0.9994 | | Piece identity | 0.9963 | These are **in-distribution** numbers on chesscog's Staunton pieces. ## Intended use and limitations This is a **base model**. It does not transfer to a different physical piece set out of the box. For a custom board (e.g. 3D-printed pieces), few-shot fine-tune from the `.pt` checkpoints on a handful of side-camera photos of the starting position (see the repo's `docs/perception_piece_cnn.md`, `train_piece_cnn.py --init-dir`). It assumes the board is already grounded (4 corners + homography); it does not detect the board itself. ## How to use ```python from chess_robot.perception.piece_cnn_config import load_two_stage_config from chess_robot.perception.piece_cnn_onnx import OnnxTwoStageClassifier config = load_two_stage_config("piece_cnn.yaml") class...
Source context: 0 downloads · 0 likes · Pipeline image-classification · Repo emil-332/chess-piece-cnn-chesscog