-2

I actually working on a face recognition project but getting an error such as:

from _dlib_pybind11 import *
ModuleNotFoundError: No module named '_dlib_pybind11'

Please help I'll appreciate any bits of help.

  • OS:windows 10
  • Python 3.8
  • dlib 19.18.0
  • face_recognition 1.3.0
  • NumPy 1.18.4

My code:

import cv2
import numpy as np
import face_recognition

imElon = face_recognition.load_image_file("ImageBasic/ElonMusk.jpg")
imElon = cv2.cvtColor(imElon.cv2.COLOR_BGR2RGB)

imTest = face_recognition.load_image_file("ImageBasic/ElonTest.jpg")
imTest = cv2.cvtColor(imTest.cv2.COLOR_BGR2RGB)

faceLoc = face_recognition.face_locations(imElon)[0]
encodeElon = face_recognition.face_encodings(imElon)[0]
print(faceLoc)

cv2.imshow('Elon Musk', imElon)
cv2.imshow('Elon Test', imTest)
cv2.waitkey(0)
funie200
  • 3,688
  • 5
  • 21
  • 34
John
  • 1
  • 1
  • 1

2 Answers2

0

face_recognition package is based on dlib and it is problematic package. Why don't you use deepface?

#!pip install deepface
from deepface import DeepFace
resp = DeepFace.verify(img1_path = "ImageBasic/ElonMusk.jpg", img2_path = "ImageBasic/ElonTest.jpg")
print(resp["verified"])

It builds VGG-Face model by default but you can manage the face recognition model backend. The following face recognition models are wrapped within the framework. Currently, VGG-Face, Google FaceNet and ArcFace overperform.

models = ['VGG-Face', 'Facenet', 'OpenFace', 'DeepFace', 'DeepID', 'ArcFace', 'Dlib']
DeepFace.verify("img1.jpg", "img2.jpg", model_name = models[1])

Notice that it wraps Dlib as well. But you have to install dlib as a prerequisite.

johncasey
  • 1,250
  • 8
  • 14
  • hi dear, I fixed my problem. Yes, I'll try deep face if it's effective and high quality to recognize. Thank you for answer)) – John Dec 18 '20 at 19:44
  • Hi dear, Yes I did as you wrote it worked. Thank you so much. Appreciate it! – John Jan 19 '21 at 12:05
0

I solved it by uninstalling and installing dlib

Ceragos
  • 105
  • 4