Questions tagged [max-pooling]

For questions about max pooling (as well as average pooling) operation, commonly used in convolutional neural networks for downsampling.

157 questions
0
votes
1 answer

Max Pooling layer after convolution

According to my understanding a maxpool layer works on convolution 2d layer and reduces the dimensions of the layer by half but the architecture of this model shows it in a different manner. Can anyone tell me how it got decreased only by a small…
0
votes
1 answer

maxpooling what should the indices be when there're multiple max values?

What to do when there are multiple values in the kernel that equals to the max? For example, for these values: array([[0., 0.], [0., 0.]]) The max is simply 0. What should max indices look like? should it be True's for all occurrence of…
0
votes
1 answer

python numpy maxpool: given an array and indices from argmax, returns max values

suppose I have an array called view: array([[[[ 7, 9], [10, 11]], [[19, 18], [20, 16]]], [[[24, 5], [ 6, 10]], [[18, 11], [45, 12]]]]) as you may know from maxpooling, this is a view…
Sam-gege
  • 723
  • 3
  • 12
0
votes
0 answers

Custom Max-Pooling layer for image classification

I want to make a custom pooling layer in a CNN model using keras tensorflow. For visual description (click here) In the above picture it shows a maxpooling operation on a 4x4 feature map with 2x2 filter and the output is a 2x2 feature map. I want…
0
votes
1 answer

function for Ordinal Pooling Neural network

please I want to create a function that computes the Ordinal Pooling neural network like the following figure: this is my function : def Ordinal_Pooling_NN(x): wights = torch.tensor([0.6, 0.25, 0.10, 0.05]) top = torch.topk(x, 4, dim = 1) …
Driss AL
  • 21
  • 5
0
votes
1 answer

Clarification regarding pads in Maxpool

I need clarification on pads in Maxpool. In the example here (maxpool_2d_pads) pads are mentioned as pad_bottom , pad_top , pad_right , pad_left, and in the attached screenshot pads are (0,0,1,1). Are the pads mentioned in the format (pad_bottom ,…
harry
  • 970
  • 6
  • 25
0
votes
0 answers

How to speed up a non-built in function? How to make MaxPool operation by using an elliptical or circular kernel?

I wrote a code that does MaxPool operation on tensors. In this code, I used two for loops to move the kernel on the matrix. However, when I ran this code, I saw that the code I wrote was running 50 times slower than the ready function. You can see…
akoral
  • 21
  • 4
0
votes
1 answer

Best Time Complexity of Max Pooling Operation over a multidimensional convolutional array in A CNN

Just pondering this question I discovered this algorithm that works in O(mn) time if the convolutional 2d array is mn. see how. just computing the same for a 1D case where we need to find the answer of maximum in every window of size k in an array.…
Mohnish
  • 41
  • 1
  • 5
0
votes
1 answer

why the input is incompatible with the layer model_16?

I'm training my model in order to classify sleep stages , after extracting features from my signal I collected the features(X) in a DataFrame with shape(335,48) , and y (labels) in shape of (335,) this is my code : def get_base_model(): inp =…
0
votes
1 answer

NameError: name 'max_pool2D' is not defined

I'm trying to run a code I acquired from Github for Light Field reconstruction using a CNN constructed with tensorflow. I've created a virtual environment and installed all the required packages given in the requirements.txt file, which…
0
votes
1 answer

Addition of MaxPooling 2D - ValueError: total size of new array must be unchanged

I created the following model: def create_model(input_shape = (224, 224, 3)): input_img = Input(shape=input_shape) model = efnB0_model (input_img) model = MaxPooling2D(pool_size=(2, 2), strides=2)(model) backbone = Flatten()…
Tobitor
  • 1,388
  • 1
  • 23
  • 58
0
votes
1 answer

MaxPooling2D - Positional Argument follows keyword argument

My code is the following: def create_model(input_shape = (224, 224, 3)): input_img = Input(shape=input_shape) model = efnB0_model (input_img) model = MaxPooling2D(pool_size=(3, 3), strides=2, 2)(model) backbone = model When I try…
Tobitor
  • 1,388
  • 1
  • 23
  • 58
0
votes
0 answers

how to change PyTorch maxpool (ceil mode) in TensorFlow 2.0?

self.pool3 = nn.MaxPool2d(kernel_size=2, stride=2, ceil_mode=True) # ceiling (not floor) here for even dims How to change PyTorch's ceil_mode=True in TensorFlow 2.0?
user11173832
0
votes
1 answer

Reduce the dimension of a tensor using max-pooling layer

My question is very simple: How can I reduce the dimension of a list or a tensor using max-pooling layer to 512 elements in the list: I'm trying the following code: input_ids = tokenizer.encode(question, text) print(input_ids) # input_ids…
John Smith
  • 199
  • 1
  • 1
  • 10
0
votes
1 answer

How to deal with "TypeError" due to input shape like (None, 1024, 1024, 4) while implementing your own pooling layer?

I have naively tried to implement my own pooling and unpooling functions such that the indices are retained while pooling to map the values to the indices while unpooling. Here is the code. from keras.layers import Input, Layer from keras.models…
Zeeshan Ali
  • 137
  • 1
  • 10