I'm getting the import error when trying to run a deepface code for a project I'm working on
Traceback (most recent call last):
File "face.py", line 3, in <module>
from deepface import DeepFace
File "/home/pi/.local/lib/python3.7/site-packages/deepface/DeepFace.py", line 15, in <module>
from deepface.basemodels import VGGFace, OpenFace, Facenet, Facenet512, FbDeepFace, DeepID, DlibWrapper, ArcFace, Boosting
File "/home/pi/.local/lib/python3.7/site-packages/deepface/basemodels/VGGFace.py", line 9, in <module>
from keras.models import Model, Sequential
File "/home/pi/.local/lib/python3.7/site-packages/keras/__init__.py", line 25, in <module>
from keras import models
File "/home/pi/.local/lib/python3.7/site-packages/keras/models.py", line 19, in <module>
from keras import backend
File "/home/pi/.local/lib/python3.7/site-packages/keras/backend.py", line 36, in <module>
from tensorflow.python.eager.context import get_config
ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' (/home/pi/.local/lib/python3.7/site-packages/tensorflow_core/python/eager/context.py)
This is my code
import cv2
from deepface import DeepFace
img1 = "simg.jpb"
img2 = "simg2.jpg"
print ("before")
resp = DeepFace.verify(img1_path=img1m, img2_path=img2)
print ("after")
if resp['verified']:
print("access granted")
else:
print("Access denied")
I have tried many solutions that were given here ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context' and many other sites but still get the same error.
Am running the code on Raspberry Pi 4.
Help is appreciated.