O'Reilly logo

Ensemble Machine Learning by Ankit Dixit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Implementation of CNN in Python

We have seen how we can design a CNN model. As we have discussed earlier, CNN architecture contains more than one set of convolutional and max-pooling layers along with activation functions.

Here, we will deal with the same MNIST digit classification problem to understand the working of a CNN. This problem is known as the Hello World! program of the deep learning domain. This model is adapted from Yann Lecunn's LeNet model, so we will also name our CNN architecture as LeNet.

We will create a convolutional architecture with two sets of convolutional-relu-max pooling and one dense layer for classification of extracted feature maps.

Let's create a definition for constructing our CNN:

#Here is our Network definition ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required