I have made dog breed identification it's working till last month today i try to run again i getting error uable to solve this Help

This is here i am loading model

This is the Error i getting

i have build dog breeds identification project one month ago it’s working fine TODAY I RUN again i got an unexpected error
i don’t understand the Error can anyone HELP ME

ERROR getting while i run on streamlit while i upload dog image i get error

TypeError: Error when deserializing class ‘KerasLayer’ using config={‘name’: ‘keras_layer_2’, ‘trainable’: False, ‘dtype’: ‘float32’, ‘handle’: ‘TensorFlow Hub’}. Exception encountered: Trying to load a model of incompatible/unknown type. ‘C:\Users\rm\AppData\Local\Temp\tfhub_modules\2c858e9d5fe42a1181c58c70d67244f7619f2ab2’ contains neither ‘saved_model.pb’ nor ‘saved_model.pbtxt’.

@Rajan_Gupta,

Welcome to the Tensorflow Forum!

Could you please provide standalone code to reproduce the issue described here?

Thank you!

It would also be good to know which version of TensorFlow you are using and if you updated it since the last time you used the model.

Hello Rajan!

I experienced the same error and had enormous problems with figuring it out. Since no-one answered your question yet, I decided to make an account here and hopefully help you get over this bump.

Myself I tried everything - from reinstalling my whole virtual env down to upgrading and downgrading each package. What finally worked was so simple that I cannot comprehend how I didn’t come up with it earlier.

What worked for me was following the specified path by the TypeError message and deleting the module folder. In your case you’ll have to go to 'C:\Users\rm\AppData\Local\Temp\tfhub_modules'. Then you will have to delete the ‘2c858e9d5fe42a1181c58c70d67244f7619f2ab2’ folder, but just in case make a copy of it.

When you load the saved model in your notebook, tf-hub will redownload the MobileNet model and everything should be back to normal!

Hope it works for you, have a nice day!

2 Likes

Thank you very much for the solution. Aleksander. It is inscrutable why such errors happen but I am on Mac, and the procedure is basically the same, as soon as the corresponding folder is deleted, the model works again. I made an account on this forum just to thank you.

2 Likes

Welcome to the forum Sihao and thank for recognising the community answer! that’s very nice of you!

Thank you Aleksander! I had this same issue and you helped me solve it.

Would you happen to know why this happens? Or how one can stop it from happening in the future?

1 Like

@mmkaram

I’m glad my response was helpful :slightly_smiling_face: To be honest I’ve got no clue what causes this error.
It happens infrequently enough for me that I never really bothered to look for the cause - sometimes it happens twice the same week, while in July I don’t think it’s happened even once :grinning: I know it’s not helpful but I treat it like car maintenance - you’ve just got to do it once in a while

@Sihao_Feng

Yeah I’m on Mac as well. I think the solution is the same for most if not all OS. I was also surprised that something like this occurs but just like I wrote above - it’s not burdensome enough to be an issue.