[Explanation for beginners] Introduction to pooling processing (explained in TensorFlow)

Explaining "pooling" processing for beginners

Running the TensorFlow Expert Tutorial Deep MNIST for Experts, the "pooling" process was as confusing as the "convolution". Like convolution, it's not a general term for liberal arts graduates, and I stumbled a little, but it's easy to understand. It's easier than convolution because it doesn't use a filter like convolution. "[Explanation for beginners] TensorFlow tutorial Deep MNIST" In the article, about the processing of convolutional neural networks "[Explanation for beginners] Introduction to convolutional processing" (Explanation in TensorFlow) " explains the specialization of convolution processing, so please refer to it. * Posted with reference to the image output by TensorBoard (2017/7/27) </ sup>

Overview

Overview

As explained in the article "[Explanation for beginners] TensorFlow tutorial Deep MNIST", the "pooling" process roughly organizes the features of the image. .. Not only images but also sounds and data are fine, but images are more visual and easier to understand, so I will explain using images. 10.Overview.JPG

Input / output of pooling process

The convolution process filters for features. Using an image as input and using a filter, the number of images for the number of filters is output. When using MNIST data, it is as follows. 10.Pooling_Overview01.JPG

It was like this when I arranged the actual pooling processing input / output images that I put out on TensorBoard. Unlike the convolution process, it is easy to understand because it is only roughened. 30.Pooling_image.JPG

Specific processing

The following part of the TensorFlow expert tutorial Deep MNIST for Experts is the pooling process. The same is true for the first and second layers. It can be implemented at this level by using the TensorFlow API.

# Max Pooling
def max_pool_2x2(x):
    return tf.nn.max_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME')

Image example

If you use a diagonal bar image of 4 vertical x 4 horizontal x 1 color (black only) as an input image example and perform convolution processing before pooling, the result will be as follows. In order to make the result easy to understand, it is expressed by two, "1" and "-1". 20.Pooling_Convolve01.JPG

Max Pooling Then, it is the pooling of the main subject. The TensorFlow Expert Tutorial Deep MNIST for Experts uses Max Pooling as the pooling type. Max Pooling simply selects the maximum value for each range and compresses it. 20.Pooling02_MaxPool.JPG As shown in the figure, the characteristics of the diagonal bar could be compressed in half from 4 (vertical) x 4 (horizontal) to 2 (vertical) x 2 (horizontal). This is what was described as "roughly organizing the features". By the way, there is also average pooling, in which case it is as shown in the figure below. 20.Pooling03_AvePool.JPG

Recommended Posts

[Explanation for beginners] Introduction to pooling processing (explained in TensorFlow)
[Explanation for beginners] Introduction to convolution processing (explained in TensorFlow)
Beginners read "Introduction to TensorFlow 2.0 for Experts"
[For beginners] Introduction to vectorization in machine learning
Introduction to Deep Learning (1) --Chainer is explained in an easy-to-understand manner for beginners-
[Explanation for beginners] TensorFlow tutorial Deep MNIST
Introduction to Graph Database Neo4j in Python for Beginners (for Mac OS X)
[Explanation for beginners] TensorFlow basic syntax and concept
An introduction to object-oriented programming for beginners by beginners
[Introduction to TensorBoard] Visualize TensorFlow processing to deepen understanding
Try to calculate RPN in Python (for beginners)
Introduction to Programming (Python) TA Tendency for beginners
[Introduction for beginners] Working with MySQL in Python
[For beginners] How to use say command in python!
[Introduction to TensorBoard: image] TensorFlow Visualize image processing to deepen understanding
opencv-python Introduction to image processing
How to learn TensorFlow for liberal arts and Python beginners
For beginners, how to deal with common errors in keras
[Python] Introduction to graph creation using coronavirus data [For beginners]
~ Tips for beginners to Python ③ ~
Introduction to Python For, While
Easy-to-understand explanation of Python Web application (Django) even for beginners (5) [Introduction to DB operation with Django shell]
[For beginners] How to implement O'reilly sample code in Google Colab
[Introduction to Python] How to use the in operator in a for statement?
[For beginners] How to register a library created in Python in PyPI
Pandas basics for beginners ① Reading & processing
TensorFlow MNIST For ML Beginners Translation
Pandas basics for beginners ⑧ Digit processing
TensorFlow Tutorial MNIST For ML Beginners
Introduction to regular expression processing system
Run unittests in Python (for beginners)
How to run TensorFlow 1.0 code in 2.0
An introduction to Python for non-engineers
TensorFlow Tutorial -MNIST For ML Beginners
Easy-to-understand explanation of Python web application (Django) even for beginners (4) [Routing settings / Introduction to MTV design patterns]
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_3
[For beginners] Super introduction to neural networks that even cats can understand
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_1
[Introduction to Python] Thorough explanation of the character string type used in Python!
Approach commentary for beginners to be in the top 1.5% (0.83732) of Kaggle Titanic_2
[Introduction to Python] How to use class in Python?
Introduction to Deep Learning ~ Convolution and Pooling ~
An introduction to OpenCV for machine learning
Probably the most straightforward introduction to TensorFlow
Implementation and explanation using XGBoost for beginners
Introduction to discord.py (1st day) -Preparation for discord.py-
Supplementary notes for TensorFlow MNIST For ML Beginners
An introduction to Python for machine learning
Introduction to TensorFlow-Machine Learning Terminology / Concept Explanation
Processing memos often used in pandas (beginners)
Introduction to docker Create ubuntu environment in ubuntu
Introduction to Vectors: Linear Algebra in Python <1>
Implemented DQN in TensorFlow (I wanted to ...)
Introduction to Effectiveness Verification Chapter 1 in Python
An introduction to Python for C programmers
Data analysis in Python Summary of sources to look at first for beginners