# Machine Learning - Max Pooling With Color Images

### Sandeep Balachandran ・2 min read

Making Of Terminator (22 Part Series)

Hey there,

Quarantined? No worries. I got new a post to forgot everything and to have some fun during this pandemic.

Let's see how we can perform max-pooling in our 3D convoluted output. In essence, max-pooling works the same way as it did for gray-scale images.

`The only difference is that now we have to perform max pooling`

on each convoluted output.

Let's see an example.

For simplicity, let's suppose that our 3D convoluted output looks like this.

As before, we will use a window size of two-by-two, and a stride of two to perform max pooling. We start by placing our window on the top left-hand corner on each convoluted output.

We now perform max-pooling on each convoluted output. For example, the values in our two-by-two window in the top

convoluted output are 1, 9, 5, and 4. Since 9 is the maximum value, which is 9 and put it in our output array.

Similarly, the values in our two-by-two window in the middle convoluted output are 9, 1,5, and 6. Since 9 is the maximum value, we will choose 9 and put it in our output array.

Similarly, the values in our two-by-two window, in the bottom convoluted output are 7, 6, 5, and 2. Since 7 is the maximum value, we choose 7 and put it in our output array.

Continuing in this fashion, we get the following result.

As we can see, after performing max-pooling we end up with three, two-dimensional arrays where each two-dimensional array is half the size of its corresponding convoluted output.

Therefore, in this particular case, when we perform max-pooling on the 3D convoluted output, we get a 3D array that is half the width and height of the convoluted output, but has the same depth.

That's all the theory we need for now. I will add the code shortly.

Lets talk about validation my next post.

Making Of Terminator (22 Part Series)