CoolFace
Modelpublic

NAKSTStudio/yolov8m-chess-piece-detection

sourceHugging Faceagpl-3.0updated 11mo agoView on Hugging Face
2likes2kdownloads
Model Card

YOLOv8 Chess Piece Detection ♟️🔍

By NAKST Studio

<br> Fine-tuned <strong>YOLOv8</strong> model for real-time chess piece detection in 2D images. Trained on <strong>50,000+ images</strong> over <strong>120 epochs</strong> with enhanced generalization for real board images, videos, and app screenshots.


<div align="center">

💙 Support & Shape NAKST Studio

![Donate](https://nakststudio.com/donate) ![Vote Next App](https://nakststudio.com/vote-next-app-beta)

Help us keep building free, privacy-focused chess tools! Vote for what we build next!

</div>


Model Details

  • Base Model: YOLOv8 (Ultralytics)
  • Task: Object Detection (Chess Pieces, Chess Board)
  • Training Data: 50,000+ annotated chess board images
  • Training Epochs: 120
  • Class Set:
  • 0: board
  • 1: white_king
  • 2: white_queen
  • 3: white_rook
  • 4: white_bishop
  • 5: white_knight
  • 6: white_pawn
  • 7: black_king
  • 8: black_queen
  • 9: black_rook
  • 10: black_bishop
  • 11: black_knight
  • 12: black_pawn

Input Requirements

  • Image Format: RGB (colored), JPG/PNG/BMP
  • Resolution: Exactly 640 × 640 pixels
  • Preprocessing: Images must be frame-padded to reach 640 × 640 resolution, not stretched/distorted. Preserve board aspect ratio in center frame.
  • Order: Always RGB, batch shape [N, 640, 640, 3]
  • Strict input: Other sizes or non-padded frames may result in inaccurate detections.

Usage Example

Python (Ultralytics)

python
from ultralytics import YOLO
from PIL import Image

model = YOLO('NAKSTStudio/yolov8-chess-piece-detection')

img = Image.open('chess_board.jpg').convert('RGB')
img640 = img.resize((640, 640), Image.LANCZOS)  # manually pad if needed
results = model(img640)
for result in results:
    for box in result.boxes:
        cid = int(box.cls[0])
        print(f"{cid}: {model.names[cid]}", box.xyxy[0].tolist())

Classes

Class IDName
0board
1white_king
2white_queen
3white_rook
4white_bishop
5white_knight
6white_pawn
7black_king
8black_queen
9black_rook
10black_bishop
11black_knight
12black_pawn

Real-World Application: Chess Lab

Used in Chess Lab App by NAKST Studio for:

  • 🎥 Video-to-board analysis (video frames to FEN)
  • 🤖 Offline Stockfish chess engine board analysis

See assets/images/chess_lab_screenshot.png for visual demo

Example Detection Results

<p align="center"> <img src="assets/images/detectionexample1.png" alt="Detection Example 1" width="45%" /> <img src="assets/images/detectionexample2.png" alt="Detection Example 2" width="45%" /> </p> <p align="center"> <img src="assets/images/detection_example3.png" alt="Detection Example 3" width="45%" /> </p>

Training Configuration

  • Image size: 640 × 640, frame padded
  • Augmentation: rotation, blur, brightness, mosaic
  • Split: 80% train, 10% val, 10% test
  • Classes: 13 (includes board)

Export Formats

  • PyTorch (best.pt)
  • TFLite (FP16 for mobile)
  • - TFLite (FP32 for better precision)
  • - ONNX (Cross Platform)

License

AGPL-3.0 — free/open for research & open apps, commercial usage with source sharing.

Citation

bibtex
@model{yolov8_chess_detection_2025,
  title={YOLOv8 Chess Piece Detection: Real-Time Chess Vision},
  author={NAKST Studio},
  year={2025},
  howpublished={Hugging Face Hub},
  url={https://huggingface.co/NAKSTStudio/yolov8-chess-piece-detection}
}

Last updated 10 November 2025. Powered by 💙️ from NAKST Studio.