Closed conradogarciaberrotaran closed 4 years ago
Yes, dlib is an optional dependency. It should be loaded when dlib argument passed.
However, this should be fixed in 0.0.38. What version of deepface you are running?
Im on 0.0.38.
$ pip freeze | ag deepface
deepface==0.0.38
it is very interesting.
DlibResNet package is imported when model_name is passed as Dlib.
elif model_name == 'Dlib':
print("Using Dlib ResNet model backend", distance_metric,"distance.")
from deepface.basemodels.DlibResNet import DlibResNet #this is not a must because it is very huge.
model = DlibResNet()
dlib library is imported in DlibResNet package.
Could you send the code sample you are running? What did you pass to model_name argument?
Sure, here it is:
In [1]: from deepface import DeepFace
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-9992a767273a> in <module>
----> 1 from deepface import DeepFace
~XXXX/lib/python3.7/site-packages/deepface/DeepFace.py in <module>
20 from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace, DeepID
21 from deepface.extendedmodels import Age, Gender, Race, Emotion
---> 22 from deepface.commons import functions, realtime, distance as dst
23
24 def verify(img1_path, img2_path = '', model_name ='VGG-Face', distance_metric = 'cosine', model = None, enforce_detection = True, detector_backend = 'opencv'):
~/XXXX/lib/python3.7/site-packages/deepface/commons/realtime.py in <module>
11
12 from deepface.basemodels import VGGFace, OpenFace, Facenet, FbDeepFace, DeepID
---> 13 from deepface.basemodels.DlibResNet import DlibResNet
14 from deepface.extendedmodels import Age, Gender, Race, Emotion
15 from deepface.commons import functions, realtime, distance as dst
~/.XXXX/lib/python3.7/site-packages/deepface/basemodels/DlibResNet.py in <module>
----> 1 import dlib #19.20.0
2 import os
3 import zipfile
4 import bz2
5 import gdown
ModuleNotFoundError: No module named 'dlib'
Seems it's being imported on realtime.py line 13 https://github.com/serengil/deepface/blob/master/deepface/commons/realtime.py#L13
from deepface.basemodels.DlibResNet import DlibResNet
oke I understand, exception comes from realtime.py. I will fix it in 10 minutes. You will update deepface to 0.0.39.
Thanks!
Fixed! Could you test 0.0.39?
Sorry for the delay, it worked! Thanks
That was my fault. I could not understand it until you written the exception message detail. Thanks again for your contribution.
Hello, first of all. congrats on this great tool. I found that installing from pypi and importing
DeepFace
gives you the following error:Dlib is not found on the dependencies on the setup.py. If dlib is optional, you could wrap dlib import in a try except.
I can make a PR if needed.
Thanks!