Skip to content

manin891/ChessSight

Repository files navigation

♟️ ChessSight

A vision-powered chess analysis app with live configuration and dual interface

Important Safety Notice — FOR RESEARCH USE ONLY ChessSight is an analysis tool for offline research, dataset generation and testing. It is not intended or recommended for assisting live online play or cheating. Use responsibly. The author disclaims liability for misuse; detection and enforcement are the responsibility of online platforms.


Project Overview

ChessSight is a vision-powered chess analysis application designed primarily for web usage through a Flask dashboard, while still providing a CLI terminal interface for advanced users or offline workflows. It combines computer vision, machine learning, and chess engine integration into a complete analysis pipeline.

🖥️ Supported OS: Windows, Linux, and macOS.

  • Board Detection – Detects the chessboard on screen using YOLOv8 or OpenCV fallback.
  • Piece Recognition – Identifies all pieces and converts them into a valid FEN layout.
  • Position Evaluation – Runs Stockfish locally for move suggestions and evaluation.
  • Continuous Mode – Automatically captures and analyzes live positions from the user’s screen.
  • Dynamic Configuration – Change analysis depth, orientation, en passant, or castling settings during runtime.

⚠️ Disclaimer: ChessSight is intended only for research, dataset generation, and offline analysis. It must not be used for online play or real-time game assistance.


🖼️ Interface Preview

Web Mode (Flask) – Recommended

Web UI – Lichess, after analyzing position Web UI – Lichess, during analysis Web UI – Chess.com, after analyzing position

Web dashboard provides intuitive controls for live board analysis, configuration, and evaluation display.

Terminal Mode (CLI) – Optional

CLI – App settings overview CLI – Lichess, after analyzing position


🔍 Key Features

  • Board detection & corner localization – YOLOv8 Nano + OpenCV fallback
  • Piece recognition model – trained on synthetic auto-annotated data
  • Automatic FEN conversion – converts any detected position to valid FEN
  • Batch PNG processing – supports datasets or offline analysis
  • Integrated Stockfish engine – automatic move and evaluation output
  • Dual-mode operation – Flask web interface (primary) and CLI terminal
  • Runtime reconfiguration – allows changing key parameters during analysis

⚙️ Running ChessSight

ChessSight supports two primary launch modes:

🧩 Setup Environment

  1. Install Python dependencies:
pipenv install
pipenv shell

Linux users note: If Torch tries to use GPU automatically and you don’t have CUDA installed, install CPU-only version:

pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu
  1. Ensure the Stockfish engine is downloaded and placed in the engine/ folder within the project. Also, make sure all relevant paths in the configuration are set correctly.

1. Web Mode (Flask) – Recommended

python ./app.py

Then open your browser:

👉 http://127.0.0.1:5000 or 👉 http://localhost:5000

2. Terminal Mode (CLI)

Interactive mode with step-by-step prompts and ASCII visualization:

python ./main.py

main.py serves as the unified launcher for vision + Stockfish analysis, while app.py runs the primary Web dashboard.


🧭 How to Use the Application

Before starting analysis, ensure board orientation matches the actual position displayed on your screen. Orientation is critical for accurate piece mapping and FEN conversion.

⚠️ Important: Incorrect chessboard orientation can lead to skewed results or impossible move suggestions from the engine. Always verify the board is aligned with ChessSight settings before running analysis.

Steps Summary:

  1. Choose correct board orientation (white_bottom or black_bottom).
  2. Ensure the chessboard is fully visible on screen.
  3. Run analysis either via Web (app.py) or CLI (main.py).
  4. Review FEN and evaluation results.

⚙️ Dynamic In-App Configuration

Users can modify key parameters directly from the interface:

  • Board orientation (flip between white and black bottom)
  • Engine analysis time per move
  • Castling permissions
  • En passant availability
  • Turn context

These settings allow testing different game states or hypothetical positions without restarting the application.


🌐 Supported Boards and Piece Styles

Supported online platforms:

  • Lichess.org (classic theme)
  • Chess.com (standard 2D mode)
  • FIDE Online Arena
  • Other chess servers – may work if standard board and piece geometry

✅ Multi-platform support exists, but accuracy depends on standard boards. Non-standard boards may not work reliably.

Supported piece sets:

  • Classic
  • Neo
  • Alpha
  • Neo Wood

Future releases will expand support for additional visual themes.


🧮 Data Generation & Model Training Pipeline

ChessSight models are trained through an iterative self-labeling pipeline:

[Synthetic FEN Dataset]
        ↓
[Diagram Renderer → PNG Boards]
        ↓
[Auto-Annotation (previous model)]
        ↓
[New Training Dataset]
        ↓
[YOLO Nano Training for Board + Pieces]
        ↓
[Validation & Metrics]
Model Purpose Training Source Accuracy / AR
Board Detector (YOLO-Nano) Detects board and corners Synthetic dataset AR ≈ 1.00
Piece Detector Recognizes individual chess pieces Auto-labeled boards 90–100% per piece
FEN Converter Converts labels to FEN Internal post-processing Validity > 99%

🛠️ License & Attribution

Released under MIT License.

If used in research or publications, cite:

“ChessSight – a vision-powered chess analysis app with FEN extraction, board recognition, and live engine configuration.”


🏷️ GitHub Badges (Optional)

![Python](https://img.shields.io/badge/python-3.10-blue)
![OS](https://img.shields.io/badge/OS-Windows%7CLinux%7CmacOS-lightgrey)
![License](https://img.shields.io/badge/license-MIT-green)
![GitHub stars](https://img.shields.io/github/stars/manin891/ChessSight?style=social)