Why do we pool after convolution?
In convolutional neural networks (CNNs), the pooling layer is a common type of layer that is typically added after convolutional layers. The pooling layer is used to reduce the spatial dimensions (i.e., the width and height) of the feature maps, while preserving the depth (i.e., the number of channels).
In general, pooling layers are useful when you want to detect an object in an image regardless of its position in the image. The consequence of adding pooling layers is the reduction of overfitting, increased efficiency, and faster training times in a CNN model.
The purpose of the pooling layers is to reduce the dimensions of the hidden layer by combining the outputs of neuron clusters at the previous layer into a single neuron in the next layer.
1 Answer. Average pooling can better represent the overall strength of a feature by passing gradients through all indices(while gradient flows through only the max index in max pooling), which is very like the DenseNet itself that connections are built between any two layers.
Besides, pooling provides the ability to learn invariant features and also acts as a regularizer to further reduce the problem of overfitting.
How is convolution different from pooling? The significant difference is that a convolution layer extracts features from the data matrix, whereas the pooling layer only downsamples the data matrix.
Pooling layer is used to reduce the size of the input image. In a convolutional neural network, a convolutional layer is usually followed by a pooling layer. Pooling layer is usually added to speed up computation and to make some of the detected features more robust.
A pooling layer is a new layer added after the convolutional layer. Specifically, after a nonlinearity (e.g. ReLU) has been applied to the feature maps output by a convolutional layer; for example the layers in a model may look as follows: Input Image. Convolutional Layer.
Increases efficiency: The producer is motivated to increase his efficiency. He can enjoy high margins if he improves efficiency and reduces the cost of production. 6. Stability of trade: Stability of prices and trade conditions are ensured in pooling arrangements.
The convolutional layer is an important part of a CNN, and its main function is to extract features [14–17]. It uses convolution operators to convolute the input image and saves the convolution results to different channels of the convolution layer.
Why flatten in CNN?
Flattening is used to convert all the resultant 2-Dimensional arrays from pooled feature maps into a single long continuous linear vector. The flattened matrix is fed as input to the fully connected layer to classify the image.
Max-pooling helps in extracting low-level features like edges, points, etc. While Avg-pooling goes for smooth features. If time constraint is not a problem, then one can skip the pooling layer and use a convolutional layer to do the same.

Average pooling method smooths out the image and hence the sharp features may not be identified when this pooling method is used. Max pooling selects the brighter pixels from the image. It is useful when the background of the image is dark and we are interested in only the lighter pixels of the image.
Max pooling and average pooling are the main pooling operations in convolutional networks [34] . ... ... The max pooling method takes the maximum pixel value of the pooling region as the output feature value, preserving the texture features of the input images but may lose some useful background information [34] .
Not using pooling may cause Flattened or Fully Connected Layer to be very large as the input size and input data are enormous. As pooling layers are rich in information they certainly help in increasing the accuracy.
Like any strong priors Convolution and pooling can cause underfitting. We should only compare convolutional models to other convolutional models in benchmarks of statistical learning performance.
Pooling facilitates dimensionality reduction, introduces translation invariance, and assists feature extraction. The different pooling layers (Max, Average, and Global pooling) are commonly used in image recognition and processing tasks.
Differences
The FC layers are densely connected, meaning that every neuron in the output is connected to every input neuron. On the other hand, in a Conv layer, the neurons are not densely connected but are connected only to neighboring neurons within the width of the convolutional kernel.
What is the biggest advantage utilizing CNN? Little dependence on pre processing, decreasing the needs of human effort developing its functionalities. It is easy to understand and fast to implement. It has the highest accuracy among all alghoritms that predicts images.
Pooling can be considered as convolution whether it's max/average, right? The difference is that conv has parameters for optimization, but pooling doesn't, right? - e.g. the weights that filter in pooling has are not changed during learning.
Should CNN dropout be before or after pooling?
The general rule of thumb is to add dropout after the last pooling layer. The reasoning behind this is that pooling layers reduce the spatial size of the feature maps, which reduces the number of parameters in the model and helps prevent overfitting.
Multiple Layers
Convolutional layers are not only applied to input data, e.g. raw pixel values, but they can also be applied to the output of other layers. The stacking of convolutional layers allows a hierarchical decomposition of the input.
For a grayscale (n x n) image and (f x f) filter/kernel, the dimensions of the image resulting from a convolution operation is (n – f + 1) x (n – f + 1). For example, for an (8 x 8) image and (3 x 3) filter, the output resulting after the convolution operation would be of size (6 x 6).
Pooling is the process of extracting the features from the image output of a convolution layer. This will also follow the same process of sliding over the image with a specified pool size/kernel size.
- Pro: Everyone loves the pool. ...
- Con: Installation is expensive. ...
- Pro: Pools offer physical and mental health benefits. ...
- Con: You may need more insurance. ...
- Pro: Your pool can increase curb appeal. ...
- Con: Maintenance never ends. ...
- Diving In.
Convolutions are not densely connected, not all input nodes affect all output nodes. This gives convolutional layers more flexibility in learning. Moreover, the number of weights per layer is a lot smaller, which helps a lot with high-dimensional inputs such as image data.
A convolutional neural network (CNN or ConvNet) is a network architecture for deep learning that learns directly from data. CNNs are particularly useful for finding patterns in images to recognize objects, classes, and categories.
What is the architecture of CNN? It has three layers namely, convolutional, pooling, and a fully connected layer. It is a class of neural networks and processes data having a grid-like topology. The convolution layer is the building block of CNN carrying the main responsibility for computation.
Overfitting is a common problem in machine learning, where a model performs well on the training data, but poorly on the test data or unseen data. This means that the model has memorized the specific patterns and noise in the training data, but it cannot adapt to new situations or variations.
Deep neural networks like CNN are prone to overfitting because of the millions or billions of parameters it encloses. A model with these many parameters can overfit on the training data because it has sufficient capacity to do so.
What is the difference between pooling and flattening?
Operation: Flatten() reshapes the tensor by combining all dimensions except the batch size into one. On the other hand, GlobalAveragePooling2D() performs an average pooling operation, reducing the spatial dimensions.
We can apply a Dropout layer to the input vector, in which case it nullifies some of its features; but we can also apply it to a hidden layer, in which case it nullifies some hidden neurons. Dropout layers are important in training CNNs because they prevent overfitting on the training data.
3.3 Stride and Padding
Stride denotes how many steps we are moving in each steps in convolution.By default it is one. We can observe that the size of output is smaller that input. To maintain the dimension of output as in input , we use padding. Padding is a process of adding zeros to the input matrix symmetrically.
POOL layer: This has got no learnable parameters because all it does is calculate a specific number, no backprop learning involved! Thus number of parameters = 0.
Max Pooling is an operation that is used to downscale the image if it is not used and replace it with Convolution to extract the most important features using, it will take high computational cost. So we use Max Pooling to extract maximum value from the Feature map according to filter size and strides.
Max-pooling is used to reduce the number of feature-map coefficients to process as well as to induce the spatial-filter hierarchies by making the successive convolution layers look at increasingly large windows that is in terms of the fraction of the original input it covers.
MaxPooling contributes greatly to parameter reduction, as it downsamples the input data.
Overfitting can happen when your dataset is not large enough to accomodate your number of features. Max pooling uses a max operation to pool sets of features, leaving you with a smaller number of them. Therefore, max-pooling should logically reduce overfit.
The reason for its slowness is quite obvious-- the computer must perform tens of thousands of iterations on each feature map.
The way a max pooling layer changes the size of the receptive field depends both on the strides and on the size of the max pooling filter. The receptive field is doubled if the max pooling layer has a pool size of (2,2) and also a strides of (2,2).
What are the main advantages of using convolutional layers over fully connected layers?
Convolutions are not densely connected, not all input nodes affect all output nodes. This gives convolutional layers more flexibility in learning. Moreover, the number of weights per layer is a lot smaller, which helps a lot with high-dimensional inputs such as image data.
The CNN won't learn that straight lines exist; as a consequence, it'll be pretty confused if we later show it a picture of a square. We can prevent these cases by adding Dropout layers to the network's architecture, in order to prevent overfitting.
Max pooling is a type of operation that is typically added to CNNs following individual convolutional layers. When added to a model, max pooling reduces the dimensionality of images by reducing the number of pixels in the output from the previous convolutional layer.
The max pooling layers down sample the data. And dropout forces the neural network to learn in a more robust way. And then finally, the dense layer maps the output of the previous layers to the output layer so we can predict which class the image belongs to.
Pooling layers create a lower resolution version of the input that still contains the large or important structural elements, without the fine details which may be not usefull for the task.
Fully Connected Layer
The Fully Connected (FC) layer consists of the weights and biases along with the neurons and is used to connect the neurons between two different layers. These layers are usually placed before the output layer and form the last few layers of a CNN Architecture.
Pooling: enhancing the power of convolutions
Another common aggregation is taking the average (Average Pooling). We can see two things: First of all, the image size is reduced to its half: by taking groups of 2x2 pixels and only retaining the maximum, now the image is half bigger.
They are able to learn hierarchical features, which allows them to improve recognition performance. Pooling layers used in a convolutional block reduce the spatial dimensions of the feature maps, making the network more computationally efficient and reducing the risk of overfitting.
References
- https://ai.meta.com/blog/octconv-a-flexible-efficient-alternative-to-standard-convolution/
- https://towardsdatascience.com/a-primer-on-atrous-convolutions-and-depth-wise-separable-convolutions-443b106919f5
- https://prvnk10.medium.com/the-convolution-operation-48d72a382f5a
- https://mathworld.wolfram.com/Convolution.html
- https://datascience.stackexchange.com/questions/44518/can-pooling-ever-increase-accuracy-in-convolutional-neural-networks
- https://www.mathworks.com/help/matlab/ref/conv.html
- https://www.sciencedirect.com/topics/mathematics/convolution-theorem
- https://mathoverflow.net/questions/3455/do-convolution-and-multiplication-satisfy-any-nontrivial-algebraic-identities
- https://ai.stackexchange.com/questions/7294/optimizing-max-pooling-algorithm
- https://medium.com/geekculture/max-pooling-why-use-it-and-its-advantages-5807a0190459
- https://study.com/academy/lesson/convolution-theorem-application-examples.html
- https://towardsdatascience.com/understanding-and-calculating-the-number-of-parameters-in-convolution-neural-networks-cnns-fc88790d530d
- https://towardsdatascience.com/convolutional-layers-vs-fully-connected-layers-364f05ab460b
- https://www.linkedin.com/advice/0/what-advantages-disadvantages-using-convolutional
- https://serokell.io/blog/introduction-to-convolutional-neural-networks
- https://arxiv.org/abs/1708.07038
- https://towardsdatascience.com/covolutional-neural-network-cb0883dd6529
- https://www.sciencedirect.com/topics/engineering/convolutional-layer
- https://www.quora.com/What-is-the-difference-between-convolution-and-multiplication-of-two-signals
- https://medium.com/geekculture/deconvolution-and-how-it-works-and-its-importance-80ce8f137e1b
- https://www.canva.com/features/mirror-image/
- https://towardsdatascience.com/a-comprehensive-introduction-to-different-types-of-convolutions-in-deep-learning-669281e58215
- https://www.sanfoundry.com/signals-systems-questions-answers-online-test/
- https://iq.opengenus.org/cnn-questions/
- https://brainly.in/question/6788383
- https://www.tutorialspoint.com/what-is-convolution-in-signals-and-systems
- https://www.statlect.com/glossary/convolutions
- https://www.knowledgehut.com/blog/data-science/pooling-layer
- https://www.analyticsvidhya.com/blog/2021/04/invert-the-characteristics-of-convolution-with-involution/
- https://medium.com/@bdhuma/which-pooling-method-is-better-maxpooling-vs-minpooling-vs-average-pooling-95fb03f45a9
- https://towardsdatascience.com/how-to-reduce-training-parameters-in-cnns-while-keeping-accuracy-99-a213034a9777
- https://leesael.github.io/talk/BIML2017/part2-2.pdf
- https://studies.helsinki.fi/courses/cu/hy-CU-117630717-2021-08-01
- https://pixelied.com/features/photo-filters/invert-photo
- https://machinelearningmastery.com/convolutional-layers-for-deep-learning-neural-networks/
- https://www.cs.toronto.edu/~lczhang/360/lec/w04/convnet.html
- https://machinelearningmastery.com/pooling-layers-for-convolutional-neural-networks/
- https://heil.math.gatech.edu/6338/summer08/section4c_convolve.pdf
- https://solr.apache.org/guide/7_6/dsp.html
- https://saturncloud.io/blog/understanding-the-difference-between-flatten-and-globalaveragepooling2d-in-keras/
- https://en.wikipedia.org/wiki/Convolution
- https://towardsdatascience.com/convolution-a-journey-through-a-familiar-operators-deeper-roots-2e3311f23379
- https://medium.com/analytics-vidhya/the-perfect-fit-for-a-dnn-596954c9ea39
- https://medium.com/analytics-vidhya/understanding-convolution-operations-in-cnn-1914045816d4
- https://www.purdue.edu/freeform/ervibrations/chapter-iv-animations/convolution-integral-interpretation/
- https://www.sciencedirect.com/topics/neuroscience/deconvolution
- https://www.linkedin.com/pulse/why-activation-function-used-neural-network-mayur-ingole
- https://www.researchgate.net/figure/Toy-example-illustrating-the-drawbacks-of-max-pooling-and-average-pooling_fig2_300020038
- https://stats.stackexchange.com/questions/486376/why-do-we-even-need-max-pooling-layers
- https://www.geeksforgeeks.org/cnn-introduction-to-padding/
- https://iq.opengenus.org/output-size-of-convolution/
- https://www.merriam-webster.com/dictionary/convolution
- https://accountlearning.com/advantages-and-disadvantages-of-pool-organizations/
- https://betterexplained.com/articles/intuitive-convolution/
- https://terrytao.wordpress.com/tag/twisted-convolution/
- https://www.websupergoo.com/helpie/source/2-effects/convolution.htm
- https://www.vedantu.com/question-answer/tell-if-an-image-is-upright-or-inverted-class-12-physics-jee-main-637366c25c4463725f7d33f6
- https://saturncloud.io/blog/where-to-add-dropout-in-neural-network/
- https://towardsai.net/p/l/introduction-to-pooling-layers-in-cnn
- https://stackoverflow.com/questions/43485361/whats-the-difference-between-conv-layer-and-pooling-layer-in-cnn
- https://www.calbanktrust.com/personal/community/blog/backyard-pool-pros-cons/
- https://dsp.stackexchange.com/questions/35155/why-is-circular-convolution-used-in-dsp-why-not-linear-convolution
- https://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_ch6.pdf
- https://www.mathworks.com/matlabcentral/answers/460828-multiplication-in-frequency-domain-equals-convolution-in-time-domain-mismatch
- https://aaweg-i.medium.com/computer-vision-2-maxpooling-and-dropouts-f89cfc5fa412
- https://www.tutorialspoint.com/digital_signal_processing/dsp_operations_on_signals_convolution.htm
- https://stats.stackexchange.com/questions/413275/why-do-we-use-the-average-pooling-layers-instead-of-max-pooling-layers-in-the-de
- https://www.simplilearn.com/tutorials/deep-learning-tutorial/convolutional-neural-network
- https://www.mathworks.com/discovery/convolutional-neural-network-matlab.html
- https://iq.opengenus.org/alternatives-to-cnn/
- https://www.codingninjas.com/studio/library/convolution-layer-padding-stride-and-pooling-in-cnn
- https://towardsdatascience.com/beginners-guide-to-understanding-convolutional-neural-networks-ae9ed58bb17d
- https://datagen.tech/guides/computer-vision/cnn-convolutional-neural-network/
- https://www.techtarget.com/searchenterpriseai/definition/deconvolutional-networks-deconvolutional-neural-networks
- https://en.wikipedia.org/wiki/Convolution_theorem
- https://www.olympus-lifescience.com/en/discovery/the-race-to-super-resolution-microscopy-is-deconvolution-enough/
- https://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch7.pdf
- https://www.cyberlink.com/blog/photo-editing-best-software/1105/how-to-invert-colors-in-an-image
- https://scholarship.rice.edu/handle/1911/18675
- https://stackoverflow.com/questions/3323063/what-is-an-inverse-mapping-function-in-image-processing
- https://www.devron.ai/kbase/how-to-choose-the-optimal-kernel-size
- https://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch6.pdf
- https://www.upgrad.com/blog/basic-cnn-architecture/
- https://www.mathworks.com/help/fixedpoint/ref/conv.html
- https://link.springer.com/article/10.1007/s00500-021-05783-5
- https://www.linkedin.com/advice/1/how-do-you-balance-trade-off-between-regularization
- https://www.physicsclassroom.com/reviews/Reflection-and-Mirrors/Reflection-and-Mirrors-Review-Answers-2
- https://stackoverflow.com/questions/54359135/should-i-use-conv-3x3-in-last-convolutional-layer-for-semantic-segmentation
- https://www.mathworks.com/matlabcentral/answers/709118-create-a-7x7-convolution-kernel-which-has-an-equivalent-effect-to-three-passes-with-a-3x3-mean-filte
- https://en.wiktionary.org/wiki/inverse_image
- https://www.mathworks.com/help/signal/ug/deconvolution.html
- http://www.microscopist.co.uk/essential-techniques/deconvolution/
- https://waterprogramming.wordpress.com/2018/09/04/implementation-of-the-moving-average-filter-using-convolution/
- https://dsp.stackexchange.com/questions/59221/is-convolution-distributive-over-multiplication
- https://www.projectpro.io/recipes/what-is-role-of-max-pooling-operation-neural-network
- https://dsp.stackexchange.com/questions/6298/breaking-a-convolution-into-smaller-pieces
- https://www.geeksforgeeks.org/cnn-introduction-to-pooling-layer/
- https://towardsdatascience.com/why-convolve-understanding-convolution-and-feature-extraction-in-deep-networks-ee45d1fdd17c
- https://towardsdatascience.com/convolution-vs-correlation-af868b6b4fb5
- https://stackoverflow.com/questions/59717290/does-maxpooling-reduce-overfitting
- https://towardsdatascience.com/transposed-convolution-demystified-84ca81b4baba
- https://medium.com/@iamvarman/how-to-calculate-the-number-of-parameters-in-the-cnn-5bd55364d7ca
- https://deeplizard.com/learn/video/ZjM_XQa5s6s
- https://math.fel.cvut.cz/en/mt/txta/1/txe3aa1d.htm
- https://blog.francium.tech/machine-learning-convolution-for-image-processing-42623c8dbec0
- https://www.sciencedirect.com/topics/mathematics/pooling-layer
- https://www.quora.com/Why-is-convolution-in-time-domain-equivalent-to-frequency-multiplication
- https://encyclopediaofmath.org/wiki/Convolution_of_functions
- https://www.researchgate.net/post/What-are-the-real-life-applications-of-correlation-and-convolution
- https://www.laserfocusworld.com/optics/article/16556298/microscopyimage-processing-a-deconvolution-revolution-for-confocal-image-enhancement
- https://eng.libretexts.org/Bookshelves/Electrical_Engineering/Signal_Processing_and_Modeling/Signals_and_Systems_(Baraniuk_et_al.)/03%3A_Time_Domain_Analysis_of_Continuous_Time_Systems/3.04%3A_Properties_of_Continuous_Time_Convolution
- https://www.geeksforgeeks.org/convolutional-block-for-image-recognition/
- https://svi.nl/Deconvolution-Algorithms
- https://staff.fnwi.uva.nl/r.vandenboomgaard/IPCV20162017/LectureNotes/IP/LocalOperators/convolutionExamples.html
- https://towardsdatascience.com/discuss-the-dog-image-classification-project-with-cnn-bc5c90ee4fec
- https://en.wikipedia.org/wiki/Erect_image
- https://byjus.com/question-answer/the-graph-of-an-inverse-function-can-be-obtained-from-the-corresponding-graph-of-original/
- https://www.baeldung.com/cs/ml-relu-dropout-layers
- https://www.baeldung.com/cs/neural-networks-conv-fc-layers
- https://www.nandantechnicals.com/2021/06/what-is-linear-convolution-and.html
- https://www.sanfoundry.com/signals-systems-questions-answers-discrete-time-convolution-1/
- https://www.researchgate.net/post/Difference_between_convolution_and_correlation
- https://www.sfu.ca/~truax/conv.html
- https://stats.stackexchange.com/questions/288261/why-is-max-pooling-necessary-in-convolutional-neural-networks
- https://math.stackexchange.com/questions/3286150/understanding-the-difference-between-pre-image-and-inverse
- https://www.thesaurus.com/browse/convolution
- https://math.stackexchange.com/questions/2232020/why-do-we-need-to-reverse-a-function-in-the-convolution-operaton
- https://sciendo.com/pdf/10.2478/fcds-2019-0016
- https://datascience.stackexchange.com/questions/46858/how-does-max-pooling-of-size-2x2-change-the-size-of-receptive-field-in-cnn
- https://class.ece.uw.edu/235dl/EE235/Project/lesson17/lesson17.html
- https://www.geeksforgeeks.org/css-invert-function/
- https://ai.stackexchange.com/questions/13738/what-is-the-difference-between-asymmetric-and-depthwise-separable-convolution
- https://www.linkedin.com/advice/0/what-best-methods-deconvolving-images-unknown
- https://towardsdatascience.com/understanding-convolutions-and-pooling-in-neural-networks-a-simple-explanation-885a2d78f211
- https://www.sciencedirect.com/topics/computer-science/convolution-operation
- https://math.stackexchange.com/questions/373455/is-the-convolution-an-invertible-operation
- https://homework.study.com/explanation/what-happens-when-you-convolve-a-function-by-itself.html
- https://paperswithcode.com/method/convolution
- https://weinman.cs.grinnell.edu/courses/CSC161/2021F/homework/convolution.shtml
- https://medium.com/@marsxiang/convolutions-transposed-and-deconvolution-6430c358a5b6
- https://dsp.stackexchange.com/questions/4723/what-is-the-physical-meaning-of-the-convolution-of-two-signals
- https://elec3004.uqcloud.net/2013/lectures/Convolution%20(Sec%201.4%20from%20Hayes%20DSP).pdf