Skip to content
ModelListedExternal
Download

Chess Piece Cnn Chesscog

Per-square chess piece classifier used as the perception front-end of an SO-101 chess-playing robot pipeline. Code:

KindOtherVersionRevision 703bd89

Model source

Kind
Other
File size
42.6–81.3 MB
Version
vRevision 703bd89
Updated
Sep 17, 2026
Downloads
0
Source
Hugging Face

Source description

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

FileWhat
occupancy.onnx / piece.onnxinference models (onnxruntime, dynamic batch)
occupancy.pt / piece.ptPyTorch checkpoints (warm-start for fine-tuning)
piece_cnn.yamlarchitecture/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:

StageAccuracy
Occupancy0.9994
Piece identity0.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

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.

License / provenance

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.

Sources

1 source
Hugging FacePrimaryVersion 703bd8926180e27c51b7fb8763673584957de076
huggingface.co/emil-332/chess-piece-cnn-chesscog/tree/703bd8926180e27c51b7fb8763673584957de076

Verified Sep 17

Model artifacts

4 artifacts

occupancy.onnx

onnx · 42.6 MB · SHA-256 2c7519efe2b6…afcd · Hugging Face

Download

occupancy.pt

pt · 42.7 MB · SHA-256 ecba7ae50ca2…9bfc · Hugging Face

Download

piece.onnx

onnx · 81.2 MB · SHA-256 57e92c1a54e6…f599 · Hugging Face

Download

piece.pt

pt · 81.3 MB · SHA-256 36b94c377a37…6737 · Hugging Face

Download

Source excerpts

2 excerpts

--- 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