Hello, I am running on Colab using tf 2.0 and keras 2.3.1 and training using another dataset in .nii format.
Unfortunately, the algorithm outputs an error in the first epoch:
Epoch 1/20 2020-01-24 16:05:30.895469: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7 2020-01-24 16:05:36.929059: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0 Traceback (most recent call last): File "train.py", line 285, in <module> n_imgs=15*10**4, batch_size=8) File "train.py", line 275, in keras_fit_generator use_multiprocessing=True) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training.py", line 1297, in fit_generator steps_name='steps_per_epoch') File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_generator.py", line 323, in model_iteration steps_name='validation_steps') File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_generator.py", line 265, in model_iteration batch_outs = batch_function(*batch_data) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training.py", line 1070, in test_on_batch reset_metrics=reset_metrics) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_v2_utils.py", line 327, in test_on_batch output_loss_metrics=model._output_loss_metrics) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_eager.py", line 354, in test_on_batch output_loss_metrics=output_loss_metrics)) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/engine/training_eager.py", line 166, in _model_loss per_sample_losses = loss_fn.call(targets[i], outs[i]) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/keras/losses.py", line 221, in call return self.fn(y_true, y_pred, **self._fn_kwargs) File "/content/drive/My Drive/promise12_segmentation2/codes/metrics.py", line 18, in dice_coef_loss return -dice_coef(y_true, y_pred) File "/content/drive/My Drive/promise12_segmentation2/codes/metrics.py", line 12, in dice_coef intersection = K.sum(y_true_f * y_pred_f) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/math_ops.py", line 899, in binary_op_wrapper return func(x, y, name=name) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/math_ops.py", line 1206, in _mul_dispatch return gen_math_ops.mul(x, y, name=name) File "/usr/local/lib/python3.6/dist-packages/tensorflow_core/python/ops/gen_math_ops.py", line 6698, in mul _six.raise_from(_core._status_to_exception(e.code, message), None) File "<string>", line 3, in raise_from tensorflow.python.framework.errors_impl.InvalidArgumentError: cannot compute Mul as input #1(zero-based) was expected to be a int64 tensor but is a float tensor [Op:Mul] name: loss/conv2d_22_loss/mul/
Any ideas how to solve this?
Thanks in advance!