I am facing some attribute error while running face recognizing the code. My face detects code run perfectly.But while I try to run the face recognizing code it shows some attribute error. I googled and tried to follow all the steps. But still, it shows the same error. Here is my code:
face recognition
and I get the following error:
C:\Users\MAN\AppData\Local\Programs\Python\Python36\python.exe C:/Users/MAN/PycharmProjects/facerecognition/Recognise/recognize1.py Traceback (most recent call last): File "C:/Users/MAN/PycharmProjects/facerecognition/Recognise/recognize1.py", line 4, in <module> recognizer = cv2.createLBPHFaceRecognizer() AttributeError: module 'cv2.cv2' has no attribute 'createLBPHFaceRecognizer' Process finished with exit code 1.
I am using Windows platform. python 3.6 version.Thanks in advance.
You need to install opencv-contrib
pip install opencv-contrib-python
It should work after that.
if you are using python3.x and opencv==4.1.0 then use following commands First of all
python -m pip install --user opencv-contrib-python
after that use this in the python script
cv2.face.LBPHFaceRecognizer_create()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With