Search code examples
matlabopencvimage-processingimagefilter

Max pool operation in Matlab?


Is there a function that allows to compute a 2d max-pooling with predefined, kernel size and window stride in Matlab?

I was looking around but couldn't find anything so far...

Say I have a 3D cube of data [HxWxC], I'd like to run a 2d max-pooling on every channel separately (similar to the max-pool operation known from neural networks).
A similar opencv function would also help me out...


Solution

  • I ended up using matconvnet

    k = 3; % kernel_size
    p = 1; % padding size
    data_pooled = vl_nnpool(single(data),[k,k],'Pad',[p,p,p,p]);