This repository contains the final project for Introduction to Digital Imaging (2110431), which focuses on detecting and tracking chess moves from video footage. The project aims to convert chessboard states from video frames into Portable Game Notation (PGN) format using advanced computer vision and machine learning techniques.
The Chess Move Tracking system extracts each frame from a video, identifies chessboard positions, detects the pieces, and tracks their movements. It ultimately converts the detected changes into FEN (Forsyth-Edwards Notation) and then into PGN (Portable Game Notation). The key objective is to automate the tracking of chess moves from video footage with high accuracy.
- Extract Frames: Each frame of the input video is extracted for analysis.
- Model Inference: Each frame is processed through object detection models to detect chessboard corners and recognize the chess pieces.
- FEN to PGN Conversion: The detected chessboard positions are converted from FEN to PGN.
- Model Used: YOLOv8
- Training:
- Epochs: 100
- Batch Size: 32
- Data: Labeled manually using Roboflow.
- Model Used: YOLOv11m
- Training:
- Epochs: 100
- Batch Size: 16
- Freeze: 2
- Data: Combination of RoboFlow datasets and additional datasets provided by the course instructor.
Chessboard Corner Detection Data: Manually labeled data for chessboard corner detetcion using Roboflow.
Chess Piece Recognition Data: A combination of datasets from RoboFlow and additional custom datasets provided by the course instructor.
- Chessboard Corner Detection
- Identify the four corners of the chessboard in each frame using YOLOv8.
- Crop and align the board area for further processing.
- Chess Piece Recognition
- Detect chess pieces in the cropped chessboard image using YOLOv11m.
- Map the detected positions to chessboard slots.
- FEN to PGN Conversion
- Convert the detected chessboard positions from FEN to PGN.
- Aggregate PGN data into a CSV file.
- F1 Curve
- Recall Curve
- Confusion Matrix
- F1 Curve
- Recall Curve
- Confusion Matrix
Team Member | Role |
---|---|
Thiraput Khongmuak | Model, Pipeline Design, FEN to PGN Conversion |
Chanotai Krajeam | Chess Model Detection (Fast-RCNN), Corner Image Processing (Canny + Houghline) |
Chayapon Arpayatam | Chess Detection Model, Corner Detection Data & Model, Evaluation Check |
Chatdanai Porncharoensub | Chess Model Detection (YOLO11m), PGN Algorithm Improvement, Evaluation |
- Insufficient Accuracy: Initial models were not accurate enough.
- Model Comparisons: YOLO significantly outperformed Fast-RCNN and DETR models, even after fine-tuning with RoboFlow and in-class datasets.
- Model Upgrades: Upgrading from YOLOv8 to YOLOv11m significantly improved accuracy. Future work could explore larger and more advanced models.
- PGN Transformation: The algorithm for converting FEN to PGN is not generalized for all cases.