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

0 votes

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?

Apr 20 in Machine Learning by MD
• 41,660 points
1,558 views

1 answer to this question.

0 votes

Hi@MD,

LBPHFaceRecognizer module comes from a package named opencv-contrib-python. So install this package and restart your program again.

$ pip install opencv-contrib-python

Hope this will work.

answered Apr 20 by akhtar
• 17,950 points

Related Questions In Machine Learning

0 votes
1 answer

AttributeError: module 'tensorflow.compat' has no attribute 'v1'

Hi@Usman, It seems you are using an older ...READ MORE

answered Jul 18 in Machine Learning by MD
• 41,660 points
1,452 views
0 votes
1 answer
0 votes
1 answer

AttributeError: module 'tensorflow' has no attribute 'constant'

Hi@akhtar, There may be problem in the versions. ...READ MORE

answered Apr 21 in Machine Learning by MD
• 41,660 points
2,621 views
0 votes
1 answer

AttributeError: module 'tensorflow' has no attribute 'enable_eager_execution'

Hi@akhtar, Tensorflow 2.0 has eager_execution enabled by default and ...READ MORE

answered Apr 21 in Machine Learning by MD
• 41,660 points
444 views
0 votes
1 answer

AttributeError: module 'tensorflow' has no attribute 'estimator'.

Hi@akhtar, There was an environment issue, tensorflow was ...READ MORE

answered Apr 23 in Machine Learning by MD
• 41,660 points
507 views
0 votes
1 answer

AttributeError: module 'tensorflow' has no attribute 'placeholder'

Hi@akhtar, In Tensorflow 2.0, there is no placeholder. ...READ MORE

answered Jul 13 in Machine Learning by MD
• 41,660 points
137 views
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 1,196 views
0 votes
0 answers
+4 votes
6 answers