I am implementing a 3D convolution neural network and I have two questions.
Question 1
Each input is a 3D matrix of size (201,10,4). I want my filters to move across the second and third dimension in a sense that they are fully connected. Third dimension is the feature dimension. So I don't want to look in local neighbourhoods of second and third dimension. So my filter size will be of size for example (3,10,4). So filter size is equal to second and third dimension but we have weight sharing in the first dimension. Following is my code for convolving:
## input layer
input_layer = Input((201, 10, 4))
## convolutional layers
conv_layer1 = Conv3D(filters=8, kernel_size=(3, 10, 4), activation='relu')(input_layer)
conv_layer2 = Conv3D(filters=16, kernel_size=(3, 10, 4), activation='relu')(conv_layer1)
So should I use stride here so that its only doing weight sharing across the first dimension. And remains sort of fully connected in the remaining second and third dimension?
Question two
For each matrix I have an output of shape (6,) and at each index I have frequencies for each feature. So I want my model to predict frequencies for each feature. I think I need to use MSE here. But how should my output layer look like. Should it be this:
model.add(Dense(1, activation='linear'))
opt = SGD(lr=0.01, momentum=0.9)
model.compile(loss='mean_squared_error', optimizer=opt)
or this:
model.add(Dense(6, activation='linear'))
opt = SGD(lr=0.01, momentum=0.9)
model.compile(loss='mean_squared_error', optimizer=opt)
Insights will be appreciated.