0
votes

I am using classifcation with deep learning using Theano library. In convolutional_mlp code, it uses two convolutional layers with size of (5,5), and max_pool layer with (2,2) along with a fully hidden layer connected like this:

# 4D output tensor is thus of shape (batch_size, nkerns[0], 12, 12)
layer0 = LeNetConvPoolLayer(
    rng,
    input=layer0_input,
    image_shape=(batch_size, 1, 28, 28),
    filter_shape=(nkerns[0], 1, 5, 5),
    poolsize=(2, 2)
)

# Construct the second convolutional pooling layer
# filtering reduces the image size to (12-5+1, 12-5+1) = (8, 8)
# maxpooling reduces this further to (8/2, 8/2) = (4, 4)
# 4D output tensor is thus of shape (batch_size, nkerns[1], 4, 4)
layer1 = LeNetConvPoolLayer(
    rng,
    input=layer0.output,
    image_shape=(batch_size, nkerns[0], 12, 12),
    filter_shape=(nkerns[1], nkerns[0], 5, 5),
    poolsize=(2, 2)
)

# the HiddenLayer being fully-connected, it operates on 2D matrices of
# shape (batch_size, num_pixels) (i.e matrix of rasterized images).
# This will generate a matrix of shape (batch_size, nkerns[1] * 4 * 4),
# or (500, 50 * 4 * 4) = (500, 800) with the default values.
layer2_input = layer1.output.flatten(2)

layer2 = HiddenLayer(
    rng,
    input=layer2_input,
    n_in=nkerns[1] * 4 * 4,
    n_out=500,
    activation=T.tanh
)

layer3 = LogisticRegression(input=layer2.output, n_in=500, n_out=35)`

The question is that if I want to change the size of convolution layer from (5,5) to (3,3), what would be the architecture of CNN?

1
You will get a much richer understanding of CNNs if you can work this out for yourself, perhaps with a bit of help from the community. If you've tried to work out the answer, could you edit your question to include details of what you've tried and how it fails. That way we can direct our answers at clarifying your understanding instead of just providing some opaque numbers that answer the question but don't help you understand what's going on.Daniel Renshaw

1 Answers

0
votes

with 3*3 filter 2*2 pooling of 28*28 image size:

filtering reduces the image size to (28-3+1, 28-3+1) = (26, 26) and pooling reduces this further to (26/2, 26/2) = (13, 13) for first CNN layer and so on.