### Learning TensorFlow #2 - Predicting chess pieces from images using a single-layer classifier

Let's train a tensorflow neural network to tell what piece is on a chess square. In the previous post discussed how to parse input images which contained a chessboard into 32x32 grayscale chess squares. Let's look again at our input and outputs.

Let's define our output label as an integer value from 0-12, where 0 is an empty square, 1-6 is white King, Queen, Rook, Bishop, Knight Pawn, and then 7-12 are the same for black. A black pawn in this case would be 12 then. In a one-hot label vector, this would be [0, 0,0,0,0,0,0, 0,0,0,0,0,1], where the 12th index is 1 and the rest are zero.

How do we generate training data where we know the labels? One way is to take screenshots of the starting chessboard position, where we know exactly where all th…

**Input**32x32 grayscale normalized image of a single chess tile containing a piece or empty**Output**A label for which piece we think it is, there are 6 white pieces and 6 black pieces, and 1 more for an empty square, so 13 possible choices.Let's define our output label as an integer value from 0-12, where 0 is an empty square, 1-6 is white King, Queen, Rook, Bishop, Knight Pawn, and then 7-12 are the same for black. A black pawn in this case would be 12 then. In a one-hot label vector, this would be [0, 0,0,0,0,0,0, 0,0,0,0,0,1], where the 12th index is 1 and the rest are zero.

How do we generate training data where we know the labels? One way is to take screenshots of the starting chessboard position, where we know exactly where all th…