I am not sure how the convolutional neutral network in tensorflow calculates the dimension in this tutorial.
- The image has 28*28 pixels (
x_image = tf.reshape(x, [-1,28,28,1])
) - The patch size is 5x5 (
W_conv1 = weight_variable([5, 5, 1, 32]
) - The first convolutional layer is done by: (
h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1)
) - The shape of the first layer is:
h_pool1.get_shape()
andTensorShape([Dimension(10), Dimension(14), Dimension(14), Dimension(32)])
Q1: Why the first dimension is 10?
Q2: Why the 5x5 patch size reduce the dimension to 14x14? If I have a 28x28 image, and I apply 5x5 patch to all pixels, I'd expect more than 14x14.
Q3: What's does -1
do in the code for x_image
?