I would like to try doing a ‘hybrid’ pooling on my dataset of 2D images, in which we do max pooling along the rows, and average pooling along the columns.
How would you recommend I go about doing this?
It seems that fastai-v2 is still using PyTorch, so maybe I should post this on the PyTorch boards instead…?
Briefly, I see that PyTorch’s 1D pooling operations expect, essentially, 1D data, whereas I’d like to do apply 1D max pooling operations along each row of the image, followed by a 1D average pool on the remaining columns. (Or vice versa. I know these operations won’t commute, but I don’t care about the order right now).
(The idea of writing a loop in which I successively slice along each row and pass it to MaxPooling1D strikes me as prohibitively slow, even if it were parallelized among multiple workers.)
Thanks!
(The motivation for this is that for my type of images, the classifier should be translation-equivariant horizontally, but not so much vertically. Right now I just do 2D max pooling and works fine. I’m just curious to try out my idea to see if it works even better… it probably won’t, haha, but one can hope.)