rcmalli / keras-vggface

VGGFace implementation with Keras Framework
MIT License
928 stars 416 forks source link

import keras_vggface raising lot of errors #98

Open sanket1203 opened 9 months ago

sanket1203 commented 9 months ago

Following exception raised even trying to import keras_vggface

import keras_vggface Traceback (most recent call last): File "", line 1, in File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras_vggface/init.py", line 1, in from keras_vggface.vggface import VGGFace File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras_vggface/vggface.py", line 9, in from keras_vggface.models import RESNET50, VGG16, SENET50 File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras_vggface/models.py", line 12, in from keras.layers import Flatten, Dense, Input, GlobalAveragePooling2D, \ File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras/init.py", line 3, in from keras import internal File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras/internal/init.py", line 3, in from keras.internal import backend File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras/internal/backend/init.py", line 3, in from keras.src.backend import _initialize_variables as initialize_variables File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras/src/init.py", line 21, in from keras.src import applications File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras/src/applications/init.py", line 18, in from keras.src.applications.convnext import ConvNeXtBase File "/Users/sanketpatel/anaconda3/lib/python3.11/site-packages/keras/src/applications/convnext.py", line 26, in import tensorflow.compat.v2 as tf ModuleNotFoundError: No module named 'tensorflow'

medined commented 6 months ago

This command will resolve that error.

pip install tensorflow keras_applications

But then you'll see:

ImportError: cannot import name 'layer_utils' from 'keras.utils' (/data/projects/visage-match/venv/lib/python3.10/site-packages/keras/utils/init.py)

zodwick commented 4 months ago

This command will resolve that error.

pip install tensorflow keras_applications

But then you'll see:

ImportError: cannot import name 'layer_utils' from 'keras.utils' (/data/projects/visage-match/venv/lib/python3.10/site-packages/keras/utils/init.py)

having the same issue here, seems like keras depricated that in the newer version ( https://github.com/rcmalli/keras-vggface/issues/97 ). Couldn't get it to work though.

Prakratijain21 commented 3 months ago

Hi, try using tensorflow 2.13.0 and pip install keras==2.12

zodwick commented 3 months ago

Hi, try using tensorflow 2.13.0 and pip install keras==2.12

hey yes, something like this did work out for me. I dont remember the exact version numbers but i looked up the release dates of tf and keras and compared it with that of this repo and switched to that version. That solved my issue