Image Classification with CNNs – Part 3: Understanding Max Pooling and Results

Image Classification with CNNs – Part 3: Understanding Max Pooling and Results

# ai# machinelearning
Image Classification with CNNs – Part 3: Understanding Max Pooling and ResultsRijul Rajesh

In the previous article, we were going through the creation of feature map. In this article we will...

In the previous article, we were going through the creation of feature map. In this article we will go into max pooling and beyond.

We will apply another filter to the feature map.

Unlike before, instead of computing a dot product, we simply select the maximum value.

This filter moves in such a way that it does not overlap itself.

When we select the maximum value from each region, we are applying max pooling.

Max pooling selects the regions where the filter did the best job of matching the input image.

Alternatively, we can calculate the average value for each region. This is called average pooling or mean pooling.

Now, let us convert the pooled layer into a column of input nodes.

Next, we connect this output to a fully connected neural network.

This neural network has:

  • 4 input nodes
  • A single hidden layer with a ReLU activation function
  • 2 output nodes, one for the letter O and one for the letter X

First, we multiply the input values with their corresponding weights:

(1 × -0.8) + (0 × -0.07) + (0 × 0.2) + (1 × 0.17)

Then we add the bias:

(1 × -0.8) + (0 × -0.07) + (0 × 0.2) + (1 × 0.17) + 0.97

This gives us 0.34.

So, the input value on the x-axis for the activation function is 0.34.

Now we apply the ReLU activation function:

ReLU(0.34) = max(0, 0.34) = 0.34

Next, from the hidden layer to the output nodes:

  • For the letter O, after multiplying the weights and adding the bias, we get 1
  • For the letter X, after multiplying the weights and adding the bias, we get 0

So, when the input is the image of the letter O, this convolutional neural network correctly classifies it as the letter O.

We can now repeat the same process for the letter X, which we will explore in the next article.

Looking for an easier way to install tools, libraries, or entire repositories?
Try Installerpedia: a community-driven, structured installation platform that lets you install almost anything with minimal hassle and clear, reliable guidance.

Just run:

ipm install repo-name
Enter fullscreen mode Exit fullscreen mode

… and you’re done! 🚀

Installerpedia Screenshot

🔗 Explore Installerpedia here