Skip to content

Wrote and trained a CNN in TensorFlow on a Kaggle GPU to detect chess pieces. Leveraged transfer learning with the VGG16 dataset to improve performance.

Notifications You must be signed in to change notification settings

ragizaki/ChessPieceDetection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

TensorFlow CNN for Chess Piece Detection

Kaggle Link

This is an investigation into creating a CNN (Convolutional Neural Network) to classify 3D pictures of chess pieces into one of 13 categories (2 of the following for white and black creates 12 classes, and one extra class for empty square).

  • Pawn
  • Rook
  • Knight
  • Bishop
  • Queen
  • King

I created a CNN model in TensorFlow, and leveraged transfer learning on the VGG16 model trained on ImageNet to improve performance and prevent overfitting. I implemented 2 convolutional layers and one Global max pooling layer to flatten the neurons before the classification head, which consisted of a dense layer with the softmax activation.

Data Visualizations

image image

I implemented many different algorithms to improve performance and prevent overfitting.

  1. Image augmentation to account for small dataset (horizontal flipping, blurring and stretching)
  2. Transfer Learning on VGG16 model to improve performance
  3. Cached and prefetched dataset to load images directly from memory during training
  4. Early stopping with min_delta=0.0001 to prevent overfitting
  5. Batch Normalization layers to speed up training
  6. Utilized a Kaggle GPU to train the model quickly (under 3 minutes)

I also plotted a confusion matrix with Scikit and Seaborn to analyse the F1, precision and recall scores on the test dataset. I intend to use this CNN to classify chess pieces that are cropped from real 3D images of chessboards.

About

Wrote and trained a CNN in TensorFlow on a Kaggle GPU to detect chess pieces. Leveraged transfer learning with the VGG16 dataset to improve performance.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published