My input shape is (20, 10, 1)
my non working model looks like this:
num_classes = 2
model.add(Conv2D(32, (5, 5),
padding='same',
data_format='channels_last',
input_shape=input_shape))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Conv2D(32, (5, 5)))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(3, 3)))
model.add(Dropout(0.25))
model.add(Conv2D(64, (5, 5), padding='same'))
model.add(BatchNormalization())
model.add(Activation('relu'))
model.add(Conv2D(64, (5, 5)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(3, 3)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(512))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes))
model.add(Activation('softmax'))
self.model = model
Which gives me the following error:
Negative dimension size caused by subtracting 5 from 2 for 'conv2d_4/convolution' (op: 'Conv2D') with input shapes: [?,5,2,64], [5,5,64,64].
However the error disappears if I did one of two things:
1. remove all three model.add(Conv2D(64, (5, 5)))
or
2. Change ^ three Conv2D layers from (5,5)to (3,3) and change all
pool_size(2,2)
I understand that the dimensions at end of 4th layer is causing the trouble .
What should I do to make ^ model work in the present state?
Basically I want to compare performance of this model (filter size 5x5 with pool_size(3,3) with another model that uses a 3x3 filter with pool_size(2,2) . Thanks