serengil / deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
https://www.youtube.com/watch?v=WnUVYQP4h44&list=PLsS_1RYmYQQFdWqxQggXHynP1rqaYXv_E&index=1
MIT License
13.73k stars 2.15k forks source link

After recent tensorflow release (2.5.0) api stopped working #240

Closed Jertusz closed 3 years ago

Jertusz commented 3 years ago

Issue:
AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'

Problem started occurring after recent tensorflow release (ver 2.5.0).

Complete stacktrace: Traceback (most recent call last): File "deepface/api/deepface_api.py", line 8, in <module> from deepface import DeepFace File "/usr/local/lib/python3.7/site-packages/deepface/DeepFace.py", line 15, in <module> from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace, DeepID, DlibWrapper, ArcFace, Boosting File "/usr/local/lib/python3.7/site-packages/deepface/basemodels/Boosting.py", line 8, in <module> from deepface.commons import functions, distance as dst File "/usr/local/lib/python3.7/site-packages/deepface/commons/functions.py", line 16, in <module> from mtcnn import MTCNN #0.1.0 File "/usr/local/lib/python3.7/site-packages/mtcnn/__init__.py", line 26, in <module> from mtcnn.mtcnn import MTCNN File "/usr/local/lib/python3.7/site-packages/mtcnn/mtcnn.py", line 37, in <module> from mtcnn.network.factory import NetworkFactory File "/usr/local/lib/python3.7/site-packages/mtcnn/network/factory.py", line 26, in <module> from keras.layers import Input, Dense, Conv2D, MaxPooling2D, PReLU, Flatten, Softmax File "/usr/local/lib/python3.7/site-packages/keras/__init__.py", line 20, in <module> from . import initializers File "/usr/local/lib/python3.7/site-packages/keras/initializers/__init__.py", line 124, in <module> populate_deserializable_objects() File "/usr/local/lib/python3.7/site-packages/keras/initializers/__init__.py", line 82, in populate_deserializable_objects generic_utils.populate_dict_with_module_objects( AttributeError: module 'keras.utils.generic_utils' has no attribute 'populate_dict_with_module_objects'

serengil commented 3 years ago

Newly released versions come with those kind of troubles.

I recommend you to use tf 2.2.0

Jertusz commented 3 years ago

I am fully aware, just letting you know, as I'd rather just clone the repository and launch it than override your requirements file with fixes.

Thanks for the suggestion tho.

serengil commented 3 years ago

I should assigned a custom tensorflow version in the setup.py

currently, it is tf >1.9.0 and it would download the lastest one, you are right.

serengil commented 3 years ago

btw, i am closing this issue. thank you for informing.