how to solve cv2.face_LBPHFaceRecognizer object has no attribute 'load' ? [closed]

asked 2018-03-12 23:16:31 -0600

Edocit gravatar image

I used the attribute read() instead of load() to bring .yml file into my project. How con I create a recognizer with opencv 3.4.0 in python 3.6.4 64bit ?

edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by sturkmen
close date 2020-11-13 11:17:16.972590

Comments

please use read/write OR save/load consistantly (both write different files)

berak gravatar imageberak ( 2018-03-13 04:02:41 -0600 )edit

I used this line in trainer to create the file recognizer.save('trainer/trainer.yml') and this two lines to create a recognzer and load the file created in the code:

self.recognizer = cv2.face.LBPHFaceRecognizer_create()

self.recognizer.load("trainer/trainer.yml") #raises the error of the question here Hope you can help me sorry if I don't understood well what you said

Edocit gravatar imageEdocit ( 2018-03-13 05:40:22 -0600 )edit

again, please use read() and write() instead

berak gravatar imageberak ( 2018-03-13 05:43:05 -0600 )edit

I am probably facing a similar error which involves the usage of this function,please help! The code is->

 face_recognizer = cv2.face_LBPHFaceRecognizer.create()

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

I am using python 3.6 and opencv_3.4.3. I am a beginner. Please help!

Paras Jain gravatar imageParas Jain ( 2018-11-12 22:04:06 -0600 )edit

Try updating cv2 to 4.2.0 Try installing opencv-contrib-python changing the line of code as:

face_recognizer=cv2.face.LBPHFFaceRecognizer.create()

It worked for me. Hope it also works for you.😊

darkcheftar gravatar imagedarkcheftar ( 2020-03-30 11:15:30 -0600 )edit