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
1
vote
0 answers
maxpooling function in keras
What is the equivalent code for maxpooling2d with ceil mode in keras
So for example in PyTorch we can code like this :
• nn.MaxPool2d(3, stride=2, padding=0, ceil_mode=True)
But in keras, the framework only supports four parameters such as input,…

Nagaraj Rajendiran
- 21
- 2
1
vote
0 answers
Getting different words at the time of maxpooling
I am doing text classification using CNN.
Let’s say features are a 6×3 matrix and the kernel dimension is 2×3, stride = 1, without padding we will get an output vector 1×5.
Now if we add padding to make the output vector 1*6, I get two types of…

Encipher
- 1,370
- 1
- 14
- 31
1
vote
1 answer
Why do we use MaxPooling 2x2? Can we use any other size like 3x3 or 5x5? And how to select which pooling to choose in what scenrio?
Greating,
I've searched it everywhere on YouTube, Google and also read some articles and research papers but can't seem to find the exact answer to my questions
I've few questions regarding CONVOLUTIONAL NEURAL NETWORK, I'm confused with this…

Sharjeel M.
- 45
- 1
- 6
1
vote
2 answers
How can I implement Max Pooling in Arrayfire in rust without resorting to writing my own cuda code
I'm trying to figure out how to implement max pooling on Arrayfire. My current best approach involves iterating over each convolved output and apply a function which applies four kernels, [1 0 0 0], [0 1 0 0], [0 0 1 0], [0 0 0 1], and produces four…

SEMANTICALLY_INVALID
- 124
- 1
- 12
1
vote
0 answers
Why is 4D realisation of Max-Pooling in numpy misleading?
I'm trying to understand an algorithm of Max-Pooling in numpy. There are many answers like this that offer to give a new 4 - dimensional shape to two - dimensional image and then call np.max on axis 1 and 3:
window = (2, 4)
arr =…

mathfux
- 5,759
- 1
- 14
- 34
1
vote
1 answer
How to implement GlobalMinPool2D function in keras layers?
keras layers provide keras.layers.GlobalAvgPool2D and keras.layers.GlobalAvgPool2D api to implement global average 2d pooling and max pooling. But, Min Pooling also may be useful,and now I want to use GlobalMinPool2D, which the keras layers api…

mqzhang
- 39
- 4
1
vote
3 answers
Pooling for 1D tensor
I am looking for a way to reduce the length of a 1D tensor by applying a pooling operation. How can I do it? If I apply MaxPool1d, I get the error max_pool1d() input tensor must have 2 or 3 dimensions but got 1.
Here is my code:
import numpy as…

albus_c
- 6,292
- 14
- 36
- 77
1
vote
0 answers
Using K.tf.nn.max_pool_with_argmax() with an 3D input tensor
I would like to implement the SegNet for 3D images (width, height and depth, where depth is not channels). Thus in the decoder part of the network I need the pooling indices.
The function K.tf.nn.max_pool_with_argmax() only works for 2D images…

Sam Kosty
- 11
- 1
1
vote
0 answers
How to efficiently pairwise pool a tensor by trace value in Pytorch?
I have a pytorch tensor T with shape (batch_size, window_size, filters, 3, 3) and I would like to pool the tensor by trace. Specifically, I would like to obtain a tensor T_pooled of size (batch_size, window_size//2, filters, 3, 3) by comparing the…

user530316
- 79
- 6
1
vote
1 answer
Understanding average (sum) pooling padding in keras
I have a simple sum pooling implemented in keras tensorflow, using AveragePooling2D*N*N, so it creates a sum of the elements in pool with some shape, same padding so the shape won't change:
import numpy as np
import seaborn as sns
import…

Ruli
- 2,592
- 12
- 30
- 40
1
vote
2 answers
I want to use Conv1D and MaxPool1D in pytorch for a 3-d tensor to its third dimension
For example, there is a 3-d tensor, I want to run the conv1d calculation on its third dimension,
import torch
import torch.nn as nn
x = torch.rand(4,5,6)
conv1d =nn.Conv1d(in_channels=1,out_channels=2,kernel_size=5,stride=3,padding=0)
y =…

DeepBreathInSunShine
- 39
- 1
- 5
1
vote
1 answer
Keras MaxPooling3D not allowed
I'm trying to build a CNN and got stuck with MaxPooling3D layers not working. Both layers get an input shape of (1, 5, 32) and I'd like to max-pool over the depth using poolsize (1, 1, 32) so the output becomes of shape (1, 5, 1). However this…

Henk
- 73
- 8
1
vote
0 answers
Can i use both dilated convolution and maxpooling layer both at the same time?
In my DCNN architecture, where I am using a dilation factor of '2' in each convolution layer and the Maxpooling Layer.I am using both in concatenation. Though it is improving my accuracy, but I am thinking is it right to do so?
As in dilation we…

krishna chauhan
- 15
- 1
- 6
1
vote
1 answer
Output shapes and parameters of a CNN with Keras
I have difficulty understanding the output shapes and number of parameters of layers in a Keras CNN model.
Let's take this toy example:
model = Sequential()
model.add(Conv1D(7, kernel_size=40, activation="relu", input_shape=(60,…

Mark Morrisson
- 2,543
- 4
- 19
- 25
1
vote
1 answer
How to add pooling layer to BERT QA for large text
I'm trying to implement a Question answering system that deal with large input text: so the idea is to split the large input text into subsequences of 510 tokens, after I will generate the representation of each sequence independently and using a…

John Smith
- 199
- 1
- 1
- 10