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
0
votes
1 answer
pool_2d in Theano throws dimention mismatch error
While trying out the 'pool_2d' method of Theano, I got the error "Wrong number of dimensions: expected 4, got 1 with shape (16, )". The code is given below.
from theano import tensor, shared, function
from theano.tensor.signal.pool import…

Manu Soman
- 153
- 11
0
votes
0 answers
What is the most efficient way to max-pool a 2d matrix and get the index of the max-item too?
I found the below answer on implementing max-pooling with 'numpy' and 'block_reduce' of skimage. But it doesn't show how to get the index of the max value (preferably with respect to the actual matrix, not the pooled one). What is the most…

Manu Soman
- 153
- 11
0
votes
1 answer
Simple Machine Learning example with handwritten digits does not work with conv2d and MaxPooling2D
I made an easy KI learning with tensorflow 2 with this code and everything works fine.
# Install TensorFlow
import tensorflow as tf
print(tf.__version__)
# Import matplotlib library
import matplotlib.pyplot as plt
#Import numpy
import numpy as…

fhs14647
- 153
- 3
- 15
0
votes
1 answer
Custom max_pool layer: ValueError: The channel dimension of the inputs should be defined. Found `None`
I am working on tensorflow2 and I am trying to implement Max unpool with indices to implement SegNet.
When I run it I get the following problem. I am defining the def MaxUnpool2D and then calling it in the model. I suppose that the problem is given…

ucesfpa
- 11
- 1
0
votes
1 answer
How is uneven input handled with same average pooling in keras / tensorflow
Very similar to this question but for average pooling.
The accpeted answer says, that same pooling uses -inf as padding for maxpooling.
But what is used for average pooling.
Do they use just 0?

relot
- 651
- 1
- 6
- 18
0
votes
1 answer
Why does keras.backend.pool3d requires tensor_in to be 5-dimensional?
I have the following code
from tensorflow import keras
from keras import backend as K
pool_size = (2,2,2)
strides = (2,2,2)
yt = K.zeros(shape=(10,10,10))
result = keras.backend.pool3d(yt, pool_size, strides, pool_mode="avg")
When I try to run…

mato
- 503
- 8
- 18
0
votes
1 answer
How to accelerate the code below? Implementing maxpool without center element
I know maxpool and I am using it in pytorch. Maxpool with dilated parameter is as belows:
Now I want a special form of maxpool, doing maxpool with out the central element. That is the kernel size is 3X3 but the central element should be deleted.…

ToughMind
- 987
- 1
- 10
- 28
0
votes
0 answers
How to stabilize the output size of TransposedConv2d in PyTorch
I have an encoder-decoder regression network written in PyTorch which takes RGB images as input. Output is a 2D image that supposed to have the same size as the input.
For the case of patch-based analysis that I use 224x224 sized rgb patches,…

Bedir Yilmaz
- 3,823
- 5
- 34
- 54
0
votes
1 answer
MaxPooling2D has incorrect syntax which i can't find
i'm trying to make a simple classification model for the cifar-10 dataset. The model fails when it gets to Maxpooling fuction. It says that it has the incorrect Syntax but for the life of me i cannot figure out whats wrong.
Is it the version of…

Darman
- 175
- 10
0
votes
1 answer
Indices out of range for MaxUnpool2d
I am trying to understand unpooling in Pytorch because I want to build a convolutional auto-encoder.
I have the following code
from torch.autograd import Variable
data = Variable(torch.rand(1, 73, 480))
pool_t = nn.MaxPool2d(2, 2,…

Bryce Ramgovind
- 3,127
- 10
- 41
- 72
0
votes
1 answer
Error while handling chainer.function.max_pooling_2d in python
I am using max_pooling function using chainer for maxpooling operation in CNN.
I am getting the following error. i have placed the code which i used for max_pooling operation.what i need to do to resolve this…

Aruna Devi
- 1
- 2
0
votes
0 answers
Pooling LSTM output if input met certain conditions
I'm trying to recreate this architecture.
The model has embeddings and LSTM layer followed by pooling layer.
I'm stuck on how to pool multiple LSTM outputs. (not pooling time sequence).
for example, if the LSTM input sequences are:
Start1 - A -…

Jessin Ra
- 63
- 7
0
votes
0 answers
Is it possible to do maxpooling on two matrix and change it to single matrix?
Can I convert two 3x3 matrices into a single 3x3 matrix using a max pooling layer?
For example let's take 2 matrices:
matrix 1
1 2 2
0 1 0
2 1 1
matrix 2
1 0 10
1 0 1
0 1 0
using maxpool(dim = (2,2), stride =1)

ManojN
- 17
- 5
0
votes
1 answer
Error when checking target: expected dense to have shape (1,) but got array with shape (15662,) maxpooling as a first layer
I'm trying to use maxpooling as a first layer using keras and I have a problem with the input and output dimensions.
print(x_train.shape)
print(y_train.shape)
(15662, 6)
(15662,)
x_train = np.reshape(x_train, (-1,15662, 6))
y_train =…

user10950908
- 39
- 5
0
votes
1 answer
What are b, y, x and c which get flattened and returned along with the max-pooled features in tf.nn.max_pool_with_argmax?
I went through the documentation of tf.nn.max_pool_with_argmax where it is written
Performs max pooling on the input and outputs both max values and indices.
The indices in argmax are flattened, so that a maximum value at
position [b, y, x, c]…

Anubhav Pandey
- 1,285
- 1
- 14
- 18