leondgarse / Keras_insightface

Insightface Keras implementation
MIT License
241 stars 56 forks source link

Error when evaluating model #132

Open hassenhamdi opened 6 months ago

hassenhamdi commented 6 months ago

when I try to load model I get this error

Exception encountered: Could not locate class 'Policy'. Make sure custom classes are decorated with `@keras.saving.register_keras_serializable()`. Full object config: {'class_name': 'Policy', 'config': {'name': 'mixed_float16'}}
leondgarse commented 6 months ago

Which model are you trying to use? Also your TF version?

hassenhamdi commented 6 months ago

Hi , thanks for the response , Here is my specs :

Operating System: Manjaro Linux
KDE Plasma Version: 5.27.11
KDE Frameworks Version: 5.115.0
Qt Version: 5.15.12
Kernel Version: 6.6.26-1-MANJARO (64-bit)
Graphics Platform: X11
Processors: 12 × Intel® Core™ i7-10750H CPU @ 2.60GHz
Memory: 11,5 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics
Manufacturer: HP
Product Name: HP Pavilion Gaming Laptop 15-dk1xxx
System Version: Type1ProductConfigId

I have tensorflow 2.15.0

The issue is with the models listed under model backbone most of them give me the policy error , deserilisation error , 'unrecognized keyword argument passed to "layer" and AttributeError: 'str' object has no attribute 'convert_input'

,the other ported works fine ,

I did try on google colab to verify the result and gave me the same result . Additional I want to note that the tensorflow_addon in eval.py raise error even when the package is installed "ModuleNotFoundError: No module named 'keras.src.engine' " so I just deleted the import line as it not used anyway.

leondgarse commented 6 months ago

Just tested EfficientNetV2B0 and r100, and they work find under TF 2.15.0, but I can reproduce your error with TF 2.16.0.

hassenhamdi commented 6 months ago

I still getting the same error with backbone model , they need their backbone python files implementation and then loading weights as you suggested . I I tried this on my personal using tf 2.15.0 and keras 3.2.0 and the error still appear using your update evals.py file that contain the checks . Thanks to God , The ported model still work and I am highly satisfied with its result , so it is not really an issue for me , any way I just wanted to bring your attention on the matter thanks for your work .

Palestine 🇵🇸 will be "Free" from the river to the sea :) .