How to understand the "Densely Connected Layer" section in tensorflow tutorial -


in densely connected layer section of tensorflow tutorial, says image size 7 x 7, after been processed. tried code, , seem these parameters works.

but not know how 7 x 7 dimension. understand that:

  • the original image 28 x 28,
  • in 1st conv layer, max_pool_2x2 function reduce both of image dimension factor of 4, after first pooling operation, image size 7 x 7
  • here's not understand

    in 2nd conv layer, there max_pool_2x2 function call, think image size should reduce factor of 4 again. did not.

which step got wrong?

you need know stride of max pool , convolution.

def conv2d(x, w):   return tf.nn.conv2d(x, w, strides=[1, 1, 1, 1], padding='same')  def max_pool_2x2(x):   return tf.nn.max_pool(x, ksize=[1, 2, 2, 1],                         strides=[1, 2, 2, 1], padding='same') 

here, can see convolution has stride of 1 , max pool has stride of 2. how can @ max pool, takes 2x2 box, , slides on image, each time taking maximum value on 4 pixels. if have stride of 2, takes 2 steps each time moves! image size should reduce factor of 2, instead of 4.

in other words, 28x28 picture max pool 2x2 , stride 2, become 14x14. max pool 2x2 , stride 2 reduce 7x7.

to further illustrate point, let's take case of max pool 2x2 , stride 1. if don't pad image, become 27x27 image after max pool.

here's image more complete answer: enter image description here


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -