chesscog.transfer_learning package

This module contains all code to fine-tune chess recognition system to a new chess set.

Submodules

chesscog.transfer_learning.create_dataset module

Script to create the piece and occupancy classification datasets from the input dataset of images.

$ python -m chesscog.transfer_learning.create_dataset --help
usage: create_dataset.py [-h]

Create the piece and occupancy classification datasets.

optional arguments:
  -h, --help  show this help message and exit

chesscog.transfer_learning.download_dataset module

Script to download the sample dataset of a different chess set.

$ python -m chesscog.transfer_learning.download_dataset --help
usage: download_dataset.py [-h]

Download the sample transfer learning dataset.

optional arguments:
  -h, --help  show this help message and exit

chesscog.transfer_learning.download_models module

Script to download the fine-tuned classifiers on the sample dataset.

Running this script will download both classifiers used in the report in the chapter “Adapting to new chess sets”. They will be downloaded to models://transfer_learning.

$ python -m chesscog.transfer_learning.download_models --help
usage: download_models.py [-h]

Download the fine-tuned piece and occupancy classifiers.

optional arguments:
  -h, --help  show this help message and exit

chesscog.transfer_learning.evaluate module

Script to evaluate the performance of the fine-tuned recognition pipeline on the new chess set.

$ python -m chesscog.transfer_learning.evaluate --help
usage: evaluate.py [-h] [--dataset {train,val,test}] [--out OUT]

Evaluate the chess recognition system end-to-end.

optional arguments:
  -h, --help            show this help message and exit
  --dataset {train,val,test}
                        the dataset to evaluate (if unspecified, train and
                        test will be evaluated)
  --out OUT             output folder

chesscog.transfer_learning.recognition module

Script to perform a single inference using the fine-tuned system on the new dataset.

$ python -m chesscog.transfer_learning.recognition --help
usage: recognition.py [-h] [--white] [--black] file

Run the chess recognition pipeline on an input image

positional arguments:
  file        path to the input image

optional arguments:
  -h, --help  show this help message and exit
  --white     indicate that the image is from the white player's
              perspective (default)
  --black     indicate that the image is from the black player's
              perspective

chesscog.transfer_learning.train module

Script to train (i.e. fine-tune) the classifiers on the new dataset.

$ python -m chesscog.transfer_learning.train --help
usage: train.py [-h]

Fine-tune the classifiers on the new dataset.

optional arguments:
  -h, --help  show this help message and exit