I am trying to implement a 3D convolutional neural network with medical imaging that are made up of 10 contiguous image slices that are 64x64 in shape. They are gray scale images. Therefore my input dimension is 64 x 64 x 10 and my first layer is
model = Sequential()
model.add(Conv3D(32, kernel_size=(3,3,3), strides=(1, 1, 1), input_shape=(64, 64, 10)))
model.add(Activation('relu'))
model.add(MaxPooling3D(pool_size=(2, 2, 2)))
With this code I get the error
Input 0 is incompatible with layer conv3d_1: expected ndim=5, found ndim=4
Therefore I reshaped my input to
model = Sequential()
model.add(Conv3D(32, kernel_size=(3,3,3), strides=(1, 1, 1), input_shape=(64, 64, 10, 1)))
model.add(Activation('relu'))
model.add(MaxPooling3D(pool_size=(2, 2, 2)))
Now I get the error
ValueError: ('Input data in `NumpyArrayIterator` should have rank 4. You passed an array with shape', (128, 64, 64, 10, 1))
I have tried to override this in the Keras code but that leads to more errors and I am pretty sure that a volume of slices can be inputed - I just can't see where the issue is.