This notebook contains an excerpt from the book Machine Learning for OpenCV by Michael Beyeler. The code is released under the MIT license, and is available on GitHub.

Note that this excerpt contains only the raw code - the book is rich with additional explanations and illustrations. If you find this content useful, please consider supporting the work by buying the book!

Using Deep Learning to Classify Handwritten Digits

In this chapter, we want to wrap our heads around some simple versions of artificial neural nets, such as the McCulloch-Pitts neuron, the perceptron, and the multi-layer perceptron. Once we have familiarized ourselves with the basics, we will be ready to implement a more sophisticated deep neural net in order to classify handwritten digits from the popular MNIST database (short for Mixed National Institute of Standards and Technology database). For this, we will be making use of Keras, a high-level neural network library, which is also frequently used by researchers and tech companies.

Along the way, we want to get answers to the following questions:

  • How do I implement perceptrons and multilayer perceptrons in OpenCV?
  • What is the difference between stochastic and batch gradient descent, and how does it fit in with backpropagation?
  • How do I know what size my neural net should be?
  • How can I use Keras to build sophisticated deep neural networks?

Outline

The book offers a detailed treatment of the McCulloch-Pitts neuron, the perceptron, multi-layer perceptrons, and backrpopagation. For more information on the same, please refer to the book.

Excited? Then let's go!