face_recognition

Playing with face_recognition in python. It was doing well on my 18.04 ubuntu laptop. But face_recognition.face_encoding run super slow on my old surface pro 3. It needs ~0.7s per encoding, 10 times more on my ubuntu laptop. I checked the cpu speed. The ubuntu laptop is newer but should be only 50% faster. Cannot think of the reason. Maybe dlib on windows is slower somehow.

Below is my test code

import time
import os.path
import face_recognition

IMAGE_FOLDER=’data’
n=os.path.join(IMAGE_FOLDER,’113373002.jpg’)
img=cv2.imread(n,cv2.IMREAD_COLOR)

t=time.time()
face_recognition.face_encodings(img)
print(time.time()-t)

Update:

I tried to install everything with conda (following this one) but it doesn’t help. Still as slow as before. I downgraded conda to 4.6.14 and then

conda create -n p36 python=3.6
conda config –add channels conda-forge
conda install numpy
conda install scipy
conda install dlib
conda install pillow
pip install –no-dependencies face_recognition

May finally want to try conda config –set channel_priority false as well

Update Update:

Using Windows Subsystem with Linux (WSL) can get 3 times faster. But since it can’t access camera, so it is a bit useless.

Eventually decided to install Ubuntu to the tab, it runs well and also have 3 times speedup like WSL. It appears that the tardiness should be because of dlib on anaconda. But not sure how one can fix that.

Leave a Reply

Your email address will not be published. Required fields are marked *