Ok, so I am working on a project which classifies chess pieces. The input is just a chess piece from a specific chess set on a white / black square on the chessboard. So it's just an image of a chess square on the board, with a chess piece on it (or without).

Assume the dataset on which the model is trained is balanced (has the same amount of photos of every piece on a square of a specific color, etc.).

What's the best way of labeling these? I will explain what are my ideas and thoughts:

  1. 13 classes, every combination of PIECE-COLOR and EMPTY square, 13 in total. The problem with this approach though is that I think the color of the square that the piece is on will mess up with the prediction (not sure if this would be the case), even though the dataset is balanced.

  2. 25 classes, every combination of SQUARECOLOR-PIECE-COLOR and EMPTY square. I am thinking maybe this would have better results, but I don't know if that's the case, maybe it's a bit too complex?

  3. Classify the type of piece first / empty (ignoring the color at first), so 7 classes, and after the type of piece is identified then just the classification of the color (white / black). Maybe this is better than the two above, but I kinda run into the first problem, when trying to classify the color of the piece maybe the color of the square will mess up the results.

What would be best? Are there any other ideas? I want to use a classifier, not object detection, for experimental purposes. I know each one has pros and cons, but I want to hear some opinions.

Edit: After thinking a little bit I thought of a fourth method which is similar to the third one. Classify the type of piece / empty square, and then classify the color by having 4 labels which indicate square color and piece color (so 4 combinations in total).

  • $\begingroup$ Is your task to classify pieces from photos of in real life, or from screencaps of electronic chess games, or both, or something else? $\endgroup$ Commented May 23 at 12:31
  • $\begingroup$ From photos from real life, but basically the input of the problem that I described here is just a part of that photo, just think it as small photo of a chess square on a chessboard, with a piece on it (or empty) $\endgroup$
    – vct12345
    Commented May 23 at 12:34

1 Answer 1


I suggest that you just use 13 classes, and let the network learn to ignore the square's background color. I used this approach when I did a "chess position search engine" of Youtube videos, and didn't notice any issues. Neural networks are very good at learning on which features are important, and what should be ignored (or internally "normalized" away).

Granted, real-life photos have a lot more variability than digital ones. But my data had its own issues, due to overlay graphics, and pieces being in the process of being moved. Here are samples of white and black pieces.

I actually ended up having two extra categories: squares where multiple pieces overlap, and squares where the content wasn't from chess board at all (the source video was showing something else).


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .