Step 3- Defining CNN hyperparameters

Now that we have the training and test set, it's time to define the hyperparameters for the CNN model before we start constructing. In the first and the second convolutional layers, we define the width and height of each filter, that is, 3, where the number of filters is 32:

filter_size1 = 3  
num_filters1 = 32  
filter_size2 = 3  
num_filters2 = 32  

The third convolutional layer has equal dimensions but twice the filters; that is, 64 filters:

filter_size3 = 3num_filters3 = 64  

The last two layers are fully connected layers, specifying the number of neurons:

fc_size = 128     

Now let's make the training slower for more intensive training by setting a lower value of the learning rate, as follows:

learning_rate=1e-4 ...

Get Practical Convolutional Neural Networks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.