Chess Piece Detection from Angled Photos
A UC Davis project testing whether an oriented object detector can recognize chess pieces beyond ideal top-down views.
A three-person project for ECS 174, September to December 2025.
Problem
Many chess-recognition systems assume a clear top-down camera angle and even lighting. Real photos introduce perspective distortion, glare, shadows, different piece styles, and overlapping pieces.
We asked whether YOLOv8 with an oriented bounding-box head could detect and classify pieces under these less controlled conditions.
Setup
- Model
- Pretrained YOLOv8n-OBB, fine-tuned to detect black and white chess pieces
- Dataset
- Kaggle chess dataset with real and synthetic images
- Training
- 606 images, 640 px, 20 epochs, batch size 20
- Validation
- 58 images, 386 labeled piece instances
Validation results
On the project's 58-image validation split, the trained model reported:
- mAP@0.5
- 0.9875
- mAP@0.5:0.95
- 0.8996
- Precision
- 0.983
- Recall
- 0.961
Failure analysis
- Pieces cut off at the image border were sometimes missed.
- Small pawns were harder to separate from the background.
- Low-contrast piece-and-square combinations reduced visual separation.
- Heavy perspective overlap made occluded pieces harder to detect.
Limits and next step
The study used a modest validation split and did not include an external test set or an axis-aligned-box baseline. It detects pieces, but it does not yet reconstruct a legal chess position.
Next steps include perspective correction, board and FEN reconstruction, targeted augmentation for glare and extreme viewpoints, and real-world mobile testing.
My contribution
I collected chess images from online sources, trained the detection workflow, and reviewed lighting, occlusion, and cropped-piece failures. I documented the findings and proposed perspective correction and board-layout reconstruction as next steps.