Chessboard2fen
Converting real images of a chessboard to FEN codes.
Install / Use
/learn @aelmiger/Chessboard2fenREADME
About The Project
The goal of this repo is to extract and digitize a chess match from images or a video source. Images can be taken from any perspective of the board as long as all pieces are still partly visible. The digitization makes it possible to play against a chessbot or against someone online on a physical chessboard.
<img src="docs/video.gif" width=100%>Method
The digitization is split into 3 parts. First the 4 corners of the chessboard are detected using a neural net performing pose estimation. The board is then split into 64 images representing each checkerboard cell. These images are classified with another neural net.
In the last step the proposed estimated board will be compared to the current legal board moves. This fusion of information can greatly increase robustness. If a proposed move passes this check it will be appended to the stack of moves.
A YOLO based hand detector is currently being tested to avoid wrong board estimations during a chess move.
Processing of a frame takes roughly 0.8 seconds on a Laptop with i7-8550u and an MX150. At this point the detection and classification models are only trained on this specific chessboard.
<p align="center"> <img src="docs/process.png" width="500"> </p>Built With
<!-- GETTING STARTED -->Getting Started
To get a local copy up and running follow these steps.
Installation
- Clone the repo
git clone https://github.com/aelmiger/chessboard2fen.git cd chessboard2fen - Install requirements
pip install -r requirements.txt
It is important that the Tensorflow version is 2.2
For a live analysis of the current chessboard place the stockfish binaries of your operating system here: engine/stockfish
Usage
python3 detectionScript.py
<!-- LICENSE -->
License
Distributed under the MIT License. See LICENSE for more information.
Contact
Anton Elmiger - anton.elmiger@gmail.com - email
Related Skills
node-connect
345.4kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
104.6kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
345.4kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
345.4kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
