For questions about max pooling (as well as average pooling) operation, commonly used in convolutional neural networks for downsampling.
Questions tagged [max-pooling]
157 questions
4
votes
1 answer
How to select top-k elements of a keras dense layer?
I'm trying to perform a k-max pooling in order to select top-k elements of a dense with shape (None, 30). I tried a MaxPooling1D layer but it doesn't work, since keras pooling layers require at least a 2d input shape. I'm using the following Lambda…

Belkacem Thiziri
- 605
- 2
- 8
- 31
4
votes
3 answers
How to perform sum pooling in PyTorch
How to perform sum pooling in PyTorch. Specifically, if we have input (N, C, W_in, H_in) and want output (N, C, W_out, H_out) using a particular kernel_size and stride just like nn.Maxpool2d ?

adeelz92
- 469
- 1
- 5
- 17
4
votes
1 answer
How to create a neural network that has a dynamic input?
This question is a tough one: How can I feed a neural network, a dynamic input?
Answering this question will certainly help the advance of modern AI using deep learning for applications other than computer vision and speech recognition.
I will…

Gabriel Dias Rezende Martins
- 43
- 1
- 5
3
votes
3 answers
Pytorch: a similar process to reverse pooling and replicate padding?
I have a tensor A that has shape (batch_size, width, height). Assume that it has these values:
A = torch.tensor([[[0, 1],
[1, 0]]])
I am also given a number K that is a positive integer. Let K=2 in this case. I want to do a…

Minh-Long Luu
- 2,393
- 1
- 17
- 39
3
votes
0 answers
All values replaced with pool max in pytorch
Given z equal to
tensor([[[[0.0908, 0.1286, 0.6942, 0.5161],
[0.4227, 0.2154, 0.5990, 0.8666],
[0.3009, 0.2399, 0.1818, 0.7551],
[0.2396, 0.4485, 0.4027, 0.5303]],
[[0.8251, 0.7457, 0.2091, 0.7313],
…

user39430
- 150
- 5
3
votes
2 answers
Difference between the input shape for a 1D CNN, 2D CNN and 3D CNN
I'm first time building a CNN model for image classification and i'm a little bit confused about what would be the input shape for each type (1D CNN, 2D CNN, 3D CNN) and how to fix the number of filters in the convolution layer. My data is…

Andrea
- 113
- 1
- 7
3
votes
1 answer
(Faster R-CNN) ROI Pooling layer is not differentiable w.r.t the box coordinates
The paper reports that "having an RoI pooling layer that is differentiable w.r.t the box coordinates is a nontrivial problem" and refers to "ROI Warping" (crops and resizes the features to a fixed shape) that makes it fully differentiable w.r.t the…

Austin
- 31
- 1
3
votes
1 answer
How to optimize this MaxPool2d implementation
I made some implementations of MaxPool2d(Running correctly, comparing with a pytorch). When testing this on a mnist dataset, this function(updateOutput) takes a very long time to complete. How to optimize this code using numpy?
class…

annaFerdsf
- 329
- 2
- 14
3
votes
2 answers
AttributeError: module 'keras.backend' has no attribute 'set_image_dim_ordering'
model = Sequential()
K.set_image_dim_ordering('th')
model.add(Convolution2D(30, 5, 5, border_mode= 'valid' , input_shape=(1, 10, 10),activation= 'relu' ))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Convolution2D(15, 3, 3, activation= 'relu'…

Moch. Chamdani M
- 85
- 1
- 9
3
votes
1 answer
What is the desired behavior of average pooling with padding?
Recently I've trained a neural network using pytorch and there is an average pooling layer with padding in it. And I'm confused about the behavior of it as well as the definition of average pooling with padding.
For example, if we have a input…

Wenbin Xu
- 134
- 2
- 14
3
votes
2 answers
MinimumPooling in Keras
I have only found MaxPooling2D and AveragePooling2D in keras with tensorflow backend. Have been looking for MinimumPooling2D. This github link suggests to use something like this for minimum pooling (pool2d(-x))
I get an error while using a negative…

Mahmud Sabbir
- 371
- 1
- 2
- 12
3
votes
1 answer
Issues Training CNN with Prime number input dimensions
I am currently developing a CNN model with Keras (an autoencoder). This type my inputs are of shape (47,47,3), that is a 47x47 image with 3 (RGB) layers.
I have worked with some CNN's in the past, but this time my input dimensions are prime numbers…

DarkCygnus
- 7,420
- 4
- 36
- 59
3
votes
3 answers
Pytorch maxpooling over channels dimension
I was trying to build a cnn to with Pytorch, and had difficulty in maxpooling. I have taken the cs231n held by Stanford. As I recalled, maxpooling can be used as a dimensional deduction step, for example, I have this (1, 20, height, width) input ot…

Sun Chuanneng
- 127
- 1
- 9
3
votes
1 answer
keras vgg 16 shape error
im trying to fit the data with the following shape to the pretrained keras vgg19 model.
image input shape is (32383, 96, 96, 3)
label shape is (32383, 17)
and I got this error
expected block5_pool to have 4 dimensions, but got array with shape…

IKnowHowBitcoinWorks
- 329
- 3
- 12
2
votes
1 answer
Channelwise pooling in pytorch
Given a tensor of size [8, 64, 128, 128] (B, CH, H, W), I would like to apply a channelwise 2D Max Pooling Operation over a 2x2x64 region (H, W, CH) with stride of 1, so as to obtain another tensor of size [8, 1, 128, 128]. Does the code below go…

Tin
- 1,006
- 1
- 15
- 27