Hey,
Does anyone have any samples R scripts for creating a keras model with 3D conv layers?
I have MRI data (176 x 256 x 256), and I want to create a basic model to process my list of 3D Arrays representing the MRI data.
model <- keras_model_sequential()
model %>% layer_conv_3d(1, kernel_size = c(3,3,3), input_shape=c(176, 256, 256,3))
summary(model)
# Compile
model %>%
compile(loss = 'binary_crossentropy',
optimizer = 'adam',
metrics = 'accuracy')
# Fit model
history <- model %>%
fit(train_data,
train_labels,
epoch = 200,
batch_size = 32,
validation_split = 0.2)
That just outputs this error:
Error in py_call_impl(callable, dots$args, dots$keywords) :
ValueError: Error when checking input: expected conv3d_2_input to have 5 dimensions, but got array with shape (176, 256, 256)
Found very little information online, I'm not even sure, if I should be using 3D conv, although the data is 3D.
Kind regards.