Repository navigation
A new model, and a much lighter install
0.2.0 replaces the tile-by-tile model with one that reads the whole board:
- Board locator finds the board inside a larger screenshot or photo (four corners, so tilted phone photos are straightened).
- Board reader (ConvNeXt-tiny + transformer) reads all 64 squares together and detects which side is at the bottom.
- Legality step fixes impossible results (two white kings, pawns on the back rank), but only on squares the model was unsure about.
Exact-board accuracy is 97.7–100% across lichess and chess.com renders, mixed styles, embedded screenshots, book diagrams and simulated phone photos (0.1.x: 43.5% on lichess renders). See the README for the full benchmark against tsoj/Chess_diagram_to_FEN and fenshot.
New
predict_fenuses the new model, finds the board in whole screenshots, and can return orientation, confidence and board corners (output_type="full")load_predictor()for batches and custom weightschessimg2pos IMAGE...command line (--json,--lichess,--weights,--version)- Browser demo (
web/index.html, runs fully client-side) - Training (
tools/train_v2.py), ONNX export (tools/export_onnx.py) and benchmark harness (tools/benchmark/)
Breaking changes
- Inference runs on ONNX Runtime; PyTorch is no longer installed by default (
pip install "chessimg2pos[torch]"for training and.ptcheckpoints) predict_fenreturns standard FEN (8/8/...); usefen_type="expanded"for one character per square (fen_type="standard"still works, deprecated)ChessPositionPredictor,ChessRecognitionTrainerand the tile pipeline were removed; pinchessimg2pos==0.1.6if you need them
Assets
chessimg2pos-v2-onnx.zip:board.onnx+locator.onnx, downloaded automatically on first use