• Home
  • About
  • Join Us
  • Contact
Bharat Ideology
  • Insight
  • Culture
  • Economics
  • Parenting
  • Science & Tech
Subscribe
No Result
View All Result
  • Insight
  • Culture
  • Economics
  • Parenting
  • Science & Tech
Subscribe
No Result
View All Result
Bharat Ideology
No Result
View All Result
Home Science & Tech

Tensorflow Pooling layers in Convolutional Neural Network

by bharatideology
January 9, 2025
in Science & Tech
0
Tensorflow Pooling layers in Convolutional Neural Network
Share on FacebookShare on Twitter

Poling Layer is always succeed the Convolution Layer post activation function like in example shown below:

Now lets understand why we need Pooling Layer:

Related articles

India’s Digital Revolution: A Quantum Leap Towards a $5 Trillion Dream

Top 10 Generative AI Tools and Platforms Reshaping the Future

  • There is a limitation of output from the convolutional layers that they record the precise position of features in the input. This information is huge and unwanted, so pooling layer down sample the data by reducing the resolution of the feature map but still retaining features of the map required.
  • Pooling reduces the computation cost drastically

The most common pooling layer filter is of size 2×2, which discards three forth of the activations. 

Common Pooling Techniques are –

Max pooling is where we take largest of the pixel values of a segment defined by pooling size

TensorFlow Core:

tf.nn.max_pool(
input, ksize, strides, padding, data_format=None, name=None
)

tf.nn.max_pool(input_tensor, ksize=2, strides=2, padding="SAME")

TensorFlow with Keras

tf.keras.layers.MaxPool2D(
pool_size=(2, 2),
strides=None,
padding='valid',
data_format=None,
**kwargs
)

tf.keras.layers.MaxPooling2D(pool_size=(2, 2),strides=(1, 1), padding='valid')

input – for the input tensor
ksize or pool_size- for the size of the kernel/mask/filter
strides – for the jump of each filter after every iteration
padding – for the padding algorithm – either same or valid

Avg pooling is where we take average of all pixel values of a segment defined by pooling size

TensorFlow Core:

tf.nn.avg_pool2d(
   input, ksize, strides, padding, data_format='NHWC', name=None
)

tf.nn.avg_pool2d(input_tensor, ksize=2, strides=2, padding='NHWC')

TensorFlow with Keras

tf.keras.layers.AveragePooling2D(
    pool_size=(2, 2),
    strides=None,
    padding='valid',
    data_format=None,
    **kwargs
)
tf.keras.layers.AveragePooling2D(pool_size=(2, 2),strides=(1, 1), padding='valid')

input – for the input tensor
ksize or pool_size- for the size of the kernel/mask/filter
strides – for the jump of each filter after every iteration
padding – for the padding algorithm – either same or valid

Global average pooling operation for spatial data and used as replacement of Fully Connected Layer

Instead of adopting the traditional fully connected layers for classification in CNN, we directly output the spatial average of the feature maps from the last conv layer as the confidence of categories via a global average pooling layer, and then the resulting vector is fed into the softmax layer.

In traditional CNN, it is difficult to interpret how the category level information from the objective cost layer is passed back to the previous convolution layer due to the fully connected layers which act as a black box in between. In contrast, global average pooling is more meaningful and interpretable as it enforces correspondance between feature maps and categories, which is made possible by a stronger local modeling using the micro network.

Furthermore, the fully connected layers are prone to overfitting and heavily depend on dropout regularization [4] [5], while global average pooling is itself a structural regularizer, which natively prevents overfitting for the overall structure.

tf.keras.layers.GlobalAveragePooling2D(
    data_format=None, keepdims=False, **kwargs
)
tf.keras.layers.GlobalAveragePooling2D()(x)
Tags: CNNPoolingPooling LayerTensorflow

bharatideology

Related Posts

India’s Digital Revolution: A Quantum Leap Towards a $5 Trillion Dream

India’s Digital Revolution: A Quantum Leap Towards a $5 Trillion Dream

by bharatideology
February 17, 2024
0

The year is 2024, and India stands at a crossroads. The ghosts of the "fragile five" label still linger in the collective memory, but a new...

Top 10 Generative AI Tools and Platforms Reshaping the Future

Top 10 Generative AI Tools and Platforms Reshaping the Future

by bharatideology
January 9, 2025
0

Generative AI, the technology that conjures new ideas and content from thin air, is taking the world by storm. From crafting captivating images to writing eloquent...

Decoding the Future: Gen AI’s Evolution in 2024 – Trends, Strategies, and Business Impact

Decoding the Future: Gen AI’s Evolution in 2024 – Trends, Strategies, and Business Impact

by bharatideology
January 9, 2025
0

Introduction The past year has witnessed an explosive eruption in the realm of Generative AI (Gen AI), propelling it from a nascent technology to a pivotal...

Will Gemini be the AI to Rule Them All? Exploring the Rise of Google’s Multimodal Colossus

Will Gemini be the AI to Rule Them All? Exploring the Rise of Google’s Multimodal Colossus

by bharatideology
January 9, 2025
0

The landscape of Large Language Models (LLMs) has witnessed a rapid evolution, with Google playing a pivotal role in pushing boundaries. Enter Gemini, Google's latest LLM,...

GenAI, LLMs, and Vector Databases: Revolutionizing Recommendation Systems in 2024

GenAI, LLMs, and Vector Databases: Revolutionizing Recommendation Systems in 2024

by bharatideology
January 9, 2025
0

Overview The world of recommendation systems is undergoing a paradigm shift, propelled by the convergence of Generative AI (GenAI) and Large Language Models (LLMs). These powerful...

CATEGORIES

  • Culture
  • Economics
  • Insight
  • Parenting
  • Science & Tech

RECOMMENDED

Will Gemini be the AI to Rule Them All? Exploring the Rise of Google’s Multimodal Colossus
Science & Tech

Will Gemini be the AI to Rule Them All? Exploring the Rise of Google’s Multimodal Colossus

January 9, 2025
India’s Global Pledge: The Impact of COVID-19 Vaccines on Worldwide Health and Solidarity
Insight

India’s Global Pledge: The Impact of COVID-19 Vaccines on Worldwide Health and Solidarity

May 19, 2023

Twitter Handle

TAGS

Agnipath Ambedkar Panchteerth Artificial Intelligence Ayodhya Ayushman Bharat Backpropogation Bhagwan Birsa Munda Museum CNN CNN Architecture Co-win Computer Vision Consecration Deep Learning Digital India Digital Revolution FutureSkills PRIME GenAI Hornbill Festival Image Segmentation International Space Station LLM Make in India Namami Gange Narendra Modi Neural Network Object Detection OCR OpenCV PLI PM Modi PRASHAD Python Ramayana Ram Mandir Recurrent Neural Network RNN Sangai Festival Semiconductor Shri Ram Janambhoomi Temple Skill India Statue of Unity Swadesh Darshan Tensorflow Vaccine Maitri Women empowerement
Bharat Ideology

Do not be led by others,
awaken your own mind,
amass your own experience,
and decide for yourself your own path - Atharv Ved

© Copyright Bharat Ideology 2023

  • About
  • Disclaimer
  • Terms & Conditions
  • Contact
No Result
View All Result
  • About
  • Contact
  • Disclaimer
  • Home
  • Terms and Conditions of use

© Copyright Bharat Ideology 2023