I have implemented a 3D-convolution neural network. The shape of my input is (500,10,4,1). I only want to convolve in first dimension such that it is ‘fully connected’ in second and third dimension in a way. So I use kernel size of (30,10,4). So far it’s fine. But when I do max pooling it reduces the second and third dimension as well. But it’s only the first dimension I want to reduce. That is after doing the max-pooling I want the first dimension (500) to become 250 but I want my second dimension and third dimension to remain 10 and 4 respectively. How can I achieve that? My code so far is :
JavaScript
x
22
22
1
###Input shape
2
i1 = Input(shape=(500,10, 4,1))
3
4
###First block
5
c1 = Conv3D(128, kernel_size=(50,10,4),activation='relu',padding='same')(i1)
6
c1 = MaxPooling3D(2)(c1)
7
c1 = Dropout(0.1)(c1)
8
9
###Second block
10
#c1 = Conv3D(128, kernel_size=(50,10,4),activation='relu',padding='same')(c1)
11
#c1 = MaxPooling3D(2)(c1)
12
#c1 = Dropout(0.1)(c1)
13
14
c = Flatten()(c1)
15
#c2 = Dropout(0.1)(c2)
16
17
###FC Layers
18
x = Dense(128, activation='relu')(c)
19
20
##Output
21
output = Dense(4,activation = 'linear')(x)
22
ERROR When I do
JavaScript
1
2
1
c1 = MaxPooling3D(2,1,1)(c1)
2
I get the following error:
Insights will be appreciated.
Advertisement
Answer
try this :
JavaScript
1
2
1
c1=MaxPool3D(pool_size=(2,1,1))(c1)
2