. Advertisement .
. Advertisement .
You might wonder how to solve AttributeError: module ‘cv2.cv2’ has no attribute ‘createLBPHFaceRecognizer’ in Python. While there are numerous guidelines available, they frequently do not cover the correct answers to assist you in finding a solution.
The next article will explore various solutions that will quickly resolve your problem. Let’s get started!
How AttributeError: module ‘cv2.cv2’ has no attribute ‘createLBPHFaceRecognizer’ Occurs?
While executing face-recognizing the code, we see certain attribute errors. The code runs flawlessly. However, executing the facial recognition code reports an attribute problem when we try to execute it.
We researched and attempted to follow all of the processes, but it still displays the same problem.
AttributeError: module 'cv2.cv2' has no attribute 'createLBPHFaceRecognizer'
How To Solve It?
You must first remove opencv-contrib using the pip uninstall opencv command before reinstalling with pip install opencv-contrib-python. And the problem is solved.
First of all, remove the opencv-contrib with the following command to uninstall it.
pip uninstall opencv-python
Then, you need to reinstall opencv-contrib by applying this line of code.
pip install opencv-contrib-python
It should work fine after that.
For the second solution, you must install opencv-contrib first using the following command.
python -m pip install --user opencv-contrib-python
Then, apply LBPHFaceRecognizer_create in the Python code as follows.
You may be using Python3 right now, in that case, you should use pip3 to acquire the opencv-contrib package.
pip3 install opencv-contrib-python
We aim to provide the best solution for these issues, and we have spent a significant amount of work fixing the AttributeError: module ‘cv2.cv2’ has no attribute ‘createLBPHFaceRecognizer’.
We believe the post has provided you with the best possible solution, as we are continually trying to improve. Please message us an email if you do have any questions or concerns.
We would be delighted to receive from you!
Leave a comment