Convolutional Neural Network - an example in Keras (Python)

Author: Goran Trlin

A simple Convolutional Neural Network example written using Keras library in Python (backed by TensorFlow).

The objective of this small program is to distinguish between hand-drawn circle and line images which are provided as the input examples for the CNN.

Key notes:

  • The CNN has 3 convolutional layers, followed by 1 MaxPooling layer and then 1 Dense layer. The output layer consists of 2 neurons activated by the softmax function
  • Convolutional layers use ReLu as the activation function
  • Categorical cross-entropy is used as the loss function
  • Stohastic Gradient Descent is used as the optimizer
  • Training dataset is very small, and that fact limits the network ability to fully learn in some cases. However, in most runs it achieves very good accuracy on the validation set

The code for this project can be found on GitHub.