-
Hello @mrdbourke,
It appers when you create own layers by subclassing existing tensorflow classes. Problem is, I didn't do that. I used EfficientNetB0 from
It's summary:
Also ploted architecture will be in attached file. I'm using TF 2.6.0, Verion 2.4.1 is not available on PIP anymore:
Becasue of that, model loses performance (6%) when I save it under .h5 format and reload it. Im planing to deploy it in application in near future. If I wanted to use it n form with best performance I would have also provide entire tensorflow lib which is problematic becasue free hosting servers usually have very limited storage and TF needs some space + weight of the model itself. I coudn't find solution to this problem anywhere. All sources addreses this issue for subclassed custom layers which is not the case here. Do you have any idea what is going on? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
since you have an efficient net as your Keras layer while saving model it doesn't get saved with the model eg |
Beta Was this translation helpful? Give feedback.
-
Hey @lukbast, Any luck in solving this? So when you're loading your model back the results are far less than before you saved it? Is the data you're testing it on the same? E.g. not shuffled every time or not testing on a different subset? Have you tried saving it to |
Beta Was this translation helpful? Give feedback.
-
Hi, @mrdbourke My issue is that some of my layers are considered as "custom", despite the fact that I didn't create any custom layers. In result, some layers configurations are not saved correctly, what results with performance loss (78% after loading vs 84% before loading). You can create custom layer by subclassing existing it's class from TF and tinker with it, and like I said before I didn't do that. Data is not the issue. I did some digging, it's an issue with EfficientNet model. It dosen't save custom gradients. Model saved in .h5 format have 6% worse accuracy than it's version before saving, but when I save it in a What I can do is to try different model or when I'll try deploy this model I just recreate it using a function and load saved weigths to maintain best accuracy. |
Beta Was this translation helpful? Give feedback.
Hi, @mrdbourke
My issue is that some of my layers are considered as "custom", despite the fact that I didn't create any custom layers. In result, some layers configurations are not saved correctly, what results with performance loss (78% after loading vs 84% before loading).
You can create custom layer by subclassing existing it's class from TF and tinker with it, and like I said before I didn't do that. Data is not the issue.
I did some digging, it's an issue with EfficientNet model. It dosen't save custom gradients. Model saved in .h5 format have 6% worse accuracy than it's version before saving, but when I save it in a
SavedModel
format, it broke completly. It's known issue:tensorflow…