Hey!
We are using transfer learning with VGG16 network, our model works giving no error when we executed it in google collab, but when we try to submit it gives the following error:
""
2022-11-13 19:22:46.452880: I tensorflow/stream_executor/cuda/cuda_dnn.cc:384] Loaded cuDNN version 8100
/multiverse/storage/lattari/Prj/postdoc/Courses/AN2DL_2022/Competition1_running_dir/worker_gpu0_dir/tmp/codalab/tmpfYvHix/run/program/score.py:267: RuntimeWarning: invalid value encountered in double_scalars
precision = tps / (tps + fps)
Traceback (most recent call last):
File "/multiverse/storage/lattari/Prj/postdoc/Courses/AN2DL_2022/Competition1_running_dir/worker_gpu0_dir/tmp/codalab/tmpfYvHix/run/program/score.py", line 278, in
raise Exception('{} F1 is NaN'.format(c))
Exception: Species3 F1 is NaN
""
We implemented the preprocessing on the model.py file as X = tf.keras.applications.vgg16.preprocess_input(X*255), maybe this is causing the error.
Therefore my questions are:
1) what could be causing the error Species3 F1 is NaN?
2) how to put the preprocessing of the VGG16 network into the model.py file to be submited?
I think the problem could that, in the preprocessing section of model.py, you shouldn't multiply by 255.
During the labs we did it so because we had divided by 255 the training data for the standard model, but in this case you don't have to, so try to write as follows:
X= preprocess_input(X).
Hope to have been of any help.
Posted by: Soli98 @ Nov. 13, 2022, 8:49 p.m.Dividing X by 255. fixed the problem for me
Posted by: JellisB @ Nov. 16, 2022, 9:35 a.m.