Closed Dragos-Stan closed 3 years ago
Hello, sorry for my late answer.
Did you run all the steps of the Jupyter notebook ?
The Mish function is defined in the first step: def mish(x): return (x* tf.math.tanh(mysoftplus(x)))
Can you check that you have run the first step of the notebook without any error
Dear Sir, thank you for your reply !
Yes I did, actually it works perfectly well, no other errors from the beginning to the end for both YoloV4_tf with image detection and YoloV4_Train_tf on VOC dataset with decent loss after training 1000 images. No error when saving the model but not possible to load_model so I had to use yolo_model = model in order to perform the detection. My hardware is a MacBookPro 2019 laptop, TensorFlow 2.3, Keras 2.4.0, Eager True, GPU = 0, but no Cuda and this is the only difference... Kind regards, Dragos
hello,
very strange, you have an issue to deserialize the custom object mish defined for activation.
I was in TF 2.1 so i have upgraded to TF 2.3.1 but I still not have the same issue. Can you upgrade in TF 2.3.1 (If you are in 2.3.0) Are you in python 3.7.3 ?
Hello
Python 3.7.6, upgraded to tf 2.3.1, the same error...
kind regards
hello,
I run the same version of Python, TF and Keras and I have no issue. The only difference is that I run under windows10. So maybe an issue in the distrib TF on MacPro.
I am running under Win10 and had the same issue. I think the problem resides in the fact that a layer is passed as an activation of another layer. As a workaround, I applied get_custom_objects().update({'mish': mish})
, which seems to resolve the problem.
Right ! Thank you very much Sir !
Thanks guys, strange behavior because I have no issue on Win 10.
so if I understand correctly, you have replaced get_custom_objects().update({'mish': Mish(mish)}) by get_custom_objects().update({'mish': mish})
thanks
Yes, that's all!
Yes, I did just that. What is more, when trying to load this model from the h5
file outside of Google Colab, toying with it in VS Code, I encountered the same error, even with this line changed. Here the workaround is:
from keras.utils.generic_utils import CustomObjectScope
with CustomObjectScope({'mish': mish}): yolo_model = load_model(r'path\to\model_dir\yolov4.h5')
Of course, the mish
and mysoftplus
functions must be imported beforehand.
Dear Sir,
Thank you very much for your beautifull work ! I'm not an expert, I just started 9 months ago as a hobby, most of my learnings coming from Jason Brownlee's - machine_learning_mastery - books including YoloV3 tutorials. Everything works perfectly except the fact that I cannot load the model !
yolo_model = load_model(...) gives the following error : "ValueError: Unknown activation function: Mish" !
Many thanks and kind regards
Dragos Stan
""
ValueError Traceback (most recent call last)