AttributeError: module 'cv2.cv2' has no attribute 'face_LBPHFaceRecognizer'

Machine Learning

Hi Guys,

I am trying to train my model using LBPHFaceRecognizer, so that it can detect my face. But I am getting this below error.

AttributeError Traceback (most recent call last)
<ipython-input-3-93a512c7e667> in <module>
24 # Create a numpy array for both training data and labels
25 Labels = np.asarray(Labels, dtype=np.int32)
---> 26 model=cv2.face_LBPHFaceRecognizer.create()
27 # Initialize facial recognizer
28 # model = cv2.face_LBPHFaceRecognizer.create()
AttributeError: module 'cv2.cv2' has no attribute 'face_LBPHFaceRecognizer'

How can I solve this error?
 

2
Answers

Replies

There is a module called LBPHFaceRecognizer module that comes from a package called opencv-contrib-python. Hence, you will need to install this package. Then restart the program which would hopefully resolve the issue. Here is the installation code.


$ pip install opencv-contrib-python

 

You should install opencv-contrib using the following command.



pip install opencv-contrib-python

 
 

If you want to unleash your potential in this competitive field, please visit the Machine Learning course page for more information, where you can find the Machine Learning tutorials and Machine Learning frequently asked interview questions and answers as well.

 

This topic has been locked/unapproved. No replies allowed

Login to participate in this discussion.

Leave a reply

Before proceeding, please check your email for a verification link. If you did not receive the email, click here to request another.