chessvision calculates the state of a real chessboard from a video stream. Necessary if we are to unleash computers superhuman chess ability into the real world, but also an excuse to train some computer vision models and collect my own dataset!
Limitations:
- Output is only concerned with the board state (not position of pieces in world space)
- Camera is assumed to be mounted directly above the chess board (small perspective shift is accounted for, but extreme angles with occlusion will be a problem)
- Only one chess board is used in pre-trained model (other boards can be used but model will need to be retrained)
guild was used in this project for experiment tracking. Highly recommend you go check it out if you haven't already.
Generates PGN:
1. f4 e5 2. g4 Qh4# 0-1
Auto-Labelling
- Visit game.py to see how one "unit" of data is stored
- Visit label.py for the actual auto-labelling functions using python-chess
- Use record.py and replay.py to record your own games
Training
- Visit train.py for a view of the training script
- Visit models.py to see some of the models that were tested
Inference
- Explore inference.py to see how the pre-trained models are used at runtime with the concepts of
VisionState
andBoardState