YOLOv8 Chess Piece Detection βοΈπ
By NAKST Studio
Fine-tuned YOLOv8 model for real-time chess piece detection in 2D images. Trained on 50,000+ images over 120 epochs with enhanced generalization for real board images, videos, and app screenshots.
π Support & Shape NAKST Studio
Help us keep building free, privacy-focused chess tools! Vote for what we build next!
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)
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 ID | Name |
|---|---|
| 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 |
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
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
@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.
- Downloads last month
- 52