Convolution Number

What does the convolution number signify in Lab 1 of Week 3?

Sample Code:
f1 = activation_model.predict(test_images[FIRST_IMAGE].reshape(1, 28, 28, 1))
axarr[0,x].imshow(f1[0, : , :, CONVOLUTION_NUMBER], cmap=‘inferno’)

Hey theLifter!

That variable CONVOLUTION_NUMBER lets us select which filter we’re looking at for the given convolutional layer.

So, if you recall to where you defined the model - we defined this layer:

tf.keras.layers.Conv2D(32, (3,3), activation='relu', input_shape=(28, 28, 1)),

The key number to think about here is that bolded 32, which is the number of filters the layer is going to learn from.

So when we specify CONVOLUTION_NUMBER, we’re really talking about “which filter do we want to look at?”

Each filter is slightly different, and so will give a different looking output! (you can learn more about filters here, as well as the video “What are convolutions and pooling” in your course)

I’d recommend playing with that CONVOLUTION_NUMBER, and try any integer between 1 and 31 (inclusive) to see how each filter has a slightly different effect - and in essence - learns a slightly different way!

Hopefully that helps explain a bit for you! :smile: