For chessboard grid detection:
- X-corner detection using Automatic Chessboard Corner Detection Method
- Iterative grid fitting from this
For piece detection:
- Data generation using LabalImg (a lot of time spent)
- Fine tune pretrained faster_rcnn_resnet50_coco from object detection api
Files:
- detection.py : piece detection
- main.py : X-corner detection, grid-fitting, integration with piece detection
- gui.py : runnable file to use this pipeline
- test.py : bulk testing of images in test folder
- ...
- Python 3.6
- OpenCV3
- tensorflow including tensorflow's models repo
- protoc
- PIL
- numpy
- scipy
- svglib
- reportlab
- pandas
- ...
git clone git@github.com:jonkoi/chess_detection.git
cd chess_detection
git clone git@github.com:tensorflow/models.git
cd models/research
protoc object_detection/protos/*.proto --python_out=.
set PYTHONPATH=PATH\TO\models\research;PATH\TO\models\research\slim (for windows)
cd ../..
- Download my fine tuned model and optionally test images (not involved in training). Extract them in the main repo folder.
- Train dataset
For simgle images:
python gui.py
For bulk testing of test images:
python test.py
The piece detection module uses deep learning (not mobilenet) which can make inference very slow. The process is sluggish even with a GTX860M.