我是深度学习的新手,我的第一个项目是面部情绪识别我正在尝试使用这个 DeepFace 库,但目前似乎有点卡住了,谁能帮忙?
import cv2
from cv2 import cvtColor
from deepface import DeepFace
import matplotlib.pyplot as plt
img = cv2.imread('Images\happy\happy_001.jpg')
# plt.imshow(cv2.cvtColor(img,cv2.COLOR_BGR2RGB))
# plt.show()
predictions = DeepFace.analyze(img, actions = ['age', 'gender', 'race', 'emotion'])
我得到的错误是
Traceback (most recent call last):
File "C:\Users\asus\OneDrive - Graphic Era University\Desktop\ML AND AI\FACE RECOG\test.py", line 11, in <module>
predictions=DeepFace.analyze(img, actions = ['age', 'gender', 'race', 'emotion'])
File "C:\Python 3.9\lib\site-packages\deepface\DeepFace.py", line 355, in analyze
models['gender'] = build_model('Gender')
File "C:\Python 3.9\lib\site-packages\deepface\DeepFace.py", line 61, in build_model
model = model()
File "C:\Python 3.9\lib\site-packages\deepface\extendedmodels\Gender.py", line 49, in loadModel
gender_model.load_weights(home+'/.deepface/weights/gender_model_weights.h5')
File "C:\Python 3.9\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Python 3.9\lib\site-packages\h5py\_hl\files.py", line 507, in __init__
fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
File "C:\Python 3.9\lib\site-packages\h5py\_hl\files.py", line 220, in make_fid
fid = h5f.open(name, flags, fapl=fapl)
File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py\h5f.pyx", line 106, in h5py.h5f.open
OSError: Unable to open file (truncated file: eof = 232972459, sblock->base_addr = 0, stored_eof = 537149760)
我当然不知道如何解决这个问题..有人可以帮忙吗?
我正在将 VS CODE 与 python 3.9.6 一起使用