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
14.41k stars 2.21k forks source link

Error while trying to detect race #193

Closed matevzb03 closed 3 years ago

matevzb03 commented 3 years ago

Hi, so I seem to get this error only with race, age, gender, and emotion seem to work fine. When I try to do race detection I get this error: File "C:\Python36\lib\site-packages\deepface\DeepFace.py", line 381, in analyze race_model = Race.loadModel() File "C:\Python36\lib\site-packages\deepface\extendedmodels\Race.py", line 46, in loadModel race_model.load_weights(home+'/.deepface/weights/race_model_single_batch.h5') File "C:\Python36\lib\site-packages\keras\engine\network.py", line 1171, in load_weights with h5py.File(filepath, mode='r') as f: File "C:\Python36\lib\site-packages\h5py_hl\files.py", line 427, in init swmr=swmr) File "C:\Python36\lib\site-packages\h5py_hl\files.py", line 190, 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 96, in h5py.h5f.open OSError: Unable to open file (truncated file: eof = 47972352, sblock->base_addr = 0, stored_eof = 537215296) Do you have any idea what could cause the issue, I spent quite some time googling if anyone else had this issue but couldn't find anything...

serengil commented 3 years ago

Load the model from this url manually: https://drive.google.com/uc?id=1nz-WDhghGQBC4biwShQ9kYjvQMpO6smj

Then unzip it in the HOME/.deepface/weights folder.