Numpy max pooling convolution
<p>Edit:</p>

<p>What I actually wanted to do is finding local maxima, which is explained good below, and the same solution is also explained here:</p>

<p><a href="http://scikit-image.org/docs/dev/auto_examples/plot_peak_local_max.html" rel="noreferrer">http://scikit-image.org/docs/dev/auto_examples/plot_peak_local_max.html</a></p>

<hr>

<hr>

<hr>

<p>It seems you can do <a href="http://docs.scipy.org/doc/numpy/reference/generated/numpy.convolve.html" rel="noreferrer">linear</a> convolution in Numpy.</p>

<p>Is it possible to do a non-linear max pooling convolution? Use a NxM patch and stride over the input image, zeroing the current pixel if it's not the maximum in the vicinity?</p>

<p>So a non-linear max convolution works like this, here is my image</p>

<pre><code>  3 4 5 2 3
  3 5 1 2 7
  2 2 5 1 7
</code></pre>

<p>And given a 2x2 max pooling gives this output</p>

<pre><code>  0 0 5 0 0
  0 5 0 0 7
  0 0 5 0 7
</code></pre>

<p>You have a 2x2 patch that strides over the image, and zeroes everything, only keeping the max value.</p>