Closed sungjinp11 closed 6 years ago
i tried "help(cv2,face)" and tried "help(cv2.face.createLBPHFaceRecognizer)"
Usage questions should go to Users OpenCV Q/A forum: http://answers.opencv.org This tracker is for issues and bugs that needs fix in OpenCV.
Issue is created for wrong repository (should be "opencv_contrib", but no need to post the same "questions" there).
This function was renamed (there is not strong requirements for API stability in opencv_contrib). Documentation is here with Python signatures.
update your opencv by "python -m pip install opencv-contrib-python"
i have tried it but this doesn't work too. still giving the same error
recoginizer = cv2.createLBPHFaceRecognizer() AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'
recoginizer = cv2.face.createLBPHFaceRecognizer() AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'
recoginizer = cv2.createLBPHFaceRecognizer() AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'
if you have that error it means the face class is installed. but the updated version of opencv-contrib doesnt have 'createLBPHFaceRecognizer' it changed the name. so to find out print(help(cv2.face))
Thank you very much chinyavadav.Your solution is the only solution which is fixing this problem.
i am getting error recoginizer = cv2.face.createLBPHFaceRecognizer() AttributeError: 'module' object has no attribute 'face'
maybe change its name in the new version of cv2
what version of python are you using
i have same error this is my version of python 3.6.5
@radwa4 Why are you posting text messages via screenshots? At least this is completely useless to search related information. Don't do this again.
Error: No space left on devices
Perhaps your last package installations have been failed and your system goes into broken state.
I don't see any message related to OpenCV, so your comment is considered unrelated to this issue and will be removed tomorrow.
this works for me............ cv2.face.LBPHFaceRecognizer_create()
Tesfamichael1074 please give me the tutorial u followed
I had similar issue. I solved it by updating cv2 library python -m pip install opencv-contrib-python
i am using opencv 3.4 on raspberry pi 3 and i am facing the same problem when i did what u say " python -m pip install opencv-contrib-python " i had error message that cv2 doesnt exist is there any thing i should do after updating the library?
On Sat, May 19, 2018 at 9:14 AM, IamDixit notifications@github.com wrote:
I had similar issue. I solved it by updating cv2 library python -m pip install opencv-contrib-python
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencv/opencv/issues/10516#issuecomment-390382851, or mute the thread https://github.com/notifications/unsubscribe-auth/Aikv3ifNDFchj3fpvoKOI_tlKx7-heVeks5tz7gpgaJpZM4RUHnT .
when i tried updating using python -m pip install opencv-contrib-python it showed error of permission denied. any idea of how to solve it
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: 'C:\Users\Alok Awasthi\AppData\Local\Programs\Python\Python36-32\Lib\site-packages\cv2\cv2.cp36-win32.pyd'
Consider using the --user
option or check the permissions.
Hi Alok, Try to add sudo before your cmd if u are not using Windows os.
Hi, I did updated cv2 using above mentioned command "sudo pip install opencv-contrib-python"
Now, when i import cv2 , error occurs that no such file exists
Anybody plz help asap. So grateful about your concerns.
Alok use command it will work.
pip install opencv-contrib-python --user
I am getting the error
recognizer = cv2.face.LBPHFaceRecognizer_create()
AttributeError: 'module' object has no attribute 'face'
If I give pip freeze adium-theme-ubuntu==0.3.4 aniso8601==3.0.2 backports-abc==0.5 backports.functools-lru-cache==1.5 backports.shutil-get-terminal-size==1.0.0 beautifulsoup4==4.4.1 bleach==2.1.3 certifi==2018.4.16 chardet==3.0.4 click==6.7 cloudpickle==0.5.3 codegen==1.0 configparser==3.5.0 cvxopt==1.1.4 cycler==0.10.0 dask==0.18.1 decorator==4.3.0 Django==1.11.14 django-debug-toolbar==1.9.1 django-json-response==1.1.5 django-mongodb-engine==0.6.0 django-tastypie==0.14.1 djangorestframework==3.8.2 djangotoolbox==1.8.0 dlib==19.13.1 entrypoints==0.2.3 enum34==1.1.6 Flask==1.0.2 Flask-Jsonpify==1.5.0 Flask-RESTful==0.3.6 Flask-SQLAlchemy==2.3.2 functools32==3.2.3.post2 futures==3.2.0 html5lib==1.0.1 idna==2.7 ipykernel==4.8.2 ipython==5.7.0 ipython-genutils==0.2.0 ipywidgets==7.2.1 itsdangerous==0.24 jdcal==1.0 Jinja2==2.10 joblib==0.9.4 jsonschema==2.6.0 jupyter==1.0.0 jupyter-client==5.2.3 jupyter-console==5.2.0 jupyter-core==4.4.0 kiwisolver==1.0.1 lxml==3.5.0 MarkupSafe==1.0 matplotlib==2.2.2 mistune==0.8.3 mongoengine==0.15.0 mysql==0.0.1 mysql-connector-python==8.0.11 MySQL-python==1.2.5 nbconvert==5.3.1 nbformat==4.4.0 networkx==2.1 nose==1.3.7 notebook==5.5.0 numexpr==2.4.3 numpy==1.14.5 opencv-contrib-python==3.4.1.15 opencv-python==3.4.1.15 openpyxl==2.3.0 pandas==0.17.1 pandocfilters==1.4.2 pathlib2==2.3.2 patsy==0.4.1 patterns==0.3 pbr==1.8.0 pexpect==4.6.0 pickleshare==0.7.4 Pillow==5.2.0 prompt-toolkit==1.0.15 protobuf==3.6.0 ptyprocess==0.5.2 py==1.4.31 pycurl==7.43.0 Pygments==2.2.0 pymongo==3.7.0 PyMySQL==0.7.2 pyparsing==2.0.3 pytest==2.8.7 python-dateutil==2.7.3 python-decouple==3.1 python-mimeparse==1.6.0 pytz==2014.10 PyWavelets==0.5.2 pyzmq==17.0.0 qtconsole==4.3.1 requests==2.19.1 scandir==1.7 scikit-image==0.14.0 scipy==0.17.0 Send2Trash==1.5.0 simplegeneric==0.8.1 simplejson==3.8.1 singledispatch==3.4.0.3 six==1.11.0 SQLAlchemy==1.2.9 sqlparse==0.2.4 statsmodels==0.6.1 stevedore==1.12.0 subprocess32==3.5.2 tables==3.2.2 terminado==0.8.1 testpath==0.3.1 toolz==0.9.0 tornado==5.0.2 traitlets==4.3.2 unity-lens-photos==1.0 urllib3==1.23 virtualenv==15.0.1 virtualenv-clone==0.2.5 virtualenvwrapper==4.3.1 wcwidth==0.1.7 webencodings==0.5.1 Werkzeug==0.14.1 widgetsnbextension==3.2.1 xlrd==0.9.4
i am getting error recoginizer = cv2.face.createLBPHFaceRecognizer() AttributeError: 'module' object has no attribute 'face' first pip install opencv-contrib-python and try like this
recoginizer = cv2.face.LBPHFaceRecognizer_create()
and for training data (if get any error for recoginizer.load(....yml)) use recoginizer.read(....yml)
I've got the same mistake and I put help(cv2.face) module 'cv2.cv2' has no attribute 'face'
How do I add the face module? to cv2
open cmd and run as administrator and upgrade using this command python -m pip install opencv-contrib-python
python -m pip install opencv-contrib-python
ya tengo el opencv-contrib-python en su última version.
open cmd and run as administrator and upgrade using this command python -m pip install opencv-contrib-python
i am still getting the same error face_recognizer = cv2.face.LBPHFaceRecognizer_create() AttributeError: module 'cv2.cv2' has no attribute 'face' even after running the cmd command
I got an error when running opencv in Python on raspberry pi.
I tried to find and apply it to fix the error, but it did not work out. I also confirmed that the module "face" is in the file opencv_contrib-3.3.0. I do not know why for some reason.
error 1
Traceback (most recent call last): File "training.py", line 13, in recognizer = cv2.face.createLBPHFaceRecognizer() AttributeError: 'module' object has no attribute 'face'
error 2
Traceback (most recent call last): File "training.py", line 13, in help(cv2.face) AttributeError: 'module' object has no attribute 'face'
error3
Traceback (most recent call last): File "training.py", line 13, in help(cv2.face.createLBPHFaceRecognizer) AttributeError: 'module' object has no attribute 'face'
python : 3.5.3 opencv-3.3.0 opencv_contrib-3.3.0
source code
Import OpenCV2 for image processing
Import os for file path
import cv2, os
Import numpy for matrix calculation
import numpy as np
Import Python Image Library (PIL)
from PIL import Image
Create Local Binary Patterns Histograms for face recognization
recognizer = cv2.face.createLBPHFaceRecognizer()
Using prebuilt frontal face training model, for face detection
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");
Create method to get the images and label data
def getImagesAndLabels(path):
# Get all file path imagePaths = [os.path.join(path,f) for f in os.listdir(path)] # Initialize empty face sample faceSamples=[] # Initialize empty id ids = [] # Loop all the file path for imagePath in imagePaths: # Get the image and convert it to grayscale PIL_img = Image.open(imagePath).convert('L') # PIL image to numpy array img_numpy = np.array(PIL_img,'uint8') # Get the image id id = int(os.path.split(imagePath)[-1].split(".")[1]) print(id) # Get the face from the training images faces = detector.detectMultiScale(img_numpy) # Loop for each face, append to their respective ID for (x,y,w,h) in faces: # Add the image to face samples faceSamples.append(img_numpy[y:y+h,x:x+w]) # Add the ID to IDs ids.append(id) # Pass the face array and IDs array return faceSamples,ids
Get the faces and IDs
faces,ids = getImagesAndLabels('dataset')
Train the model using the faces and IDs
recognizer.train(faces, np.array(ids))
Save the model into trainer.yml
recognizer.save('trainer/trainer.yml')
Bro, please tell me how to solve that issue
use this line recognizer=cv2.face.LBPHFaceRecognizer_create();
recognizer = cv2.createLBPHFaceRecognizer() try this out
first of all upgrade your opencv pakage by using command ' python -m pip install opencv-contrib-python --upgrade' , and then try out using 'recognizer=cv2.face.LBPHFaceRecognizer_create()' hope this helps
those who got an error like this :
recognizer = cv2.face.LBPHFaceRecognizer_create() AttributeError: module 'cv2.cv2' has no attribute 'face'
Solution : 1) print(dir (cv2.face)) //on python shell 2) recognizer = cv2.face.LBPHFaceRecognizer_create()
those who got an error like this :
recognizer = cv2.face.LBPHFaceRecognizer_create() AttributeError: module 'cv2.cv2' has no attribute 'face'
Solution :
- print(dir (cv2.face)) //on python shell
- recognizer = cv2.face.LBPHFaceRecognizer_create()
thank you for this...!!!!!
Try using cv2.face.createLBPHFaceRecognizer() because the repositories of updated for more information try using the command print(help(cv2.face)) in the programm
i got this error how to slove this help me. recognizer = cv2.face.LBPHFaceRecognizer_create() AttributeError: 'module' object has no attribute 'face'
this works for me............ cv2.face.LBPHFaceRecognizer_create()
please give me the code because i am getting error: module object has no attribute face
"AttributeError:'cv2. Face_LBPHFaceRecognizer' object has no attribute 'getMat" How can I solve this error?
Install opencv contribution library using pip install opencv-contrib
On Thu, Jan 30, 2020, 12:13 AM ShuhenaAonty notifications@github.com wrote:
"AttributeError:'cv2. Face_LBPHFaceRecognizer' object has no attribute 'getMat" How can I solve this error?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencv/opencv/issues/10516?email_source=notifications&email_token=AIKEWJAVKQMIZBJAC6KDI6LRAHWP5A5CNFSM4EKQPHJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKIYLUA#issuecomment-579962320, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKEWJH2RTO5WDQIKI2D65LRAHWP5ANCNFSM4EKQPHJQ .
For raspberry pi 3B try this:
- "python3 -m pip install opencv-contrib-python" installs the latest version of OpenCV on the pi which isn't compatible with Raspberry pi 3b
- if you try installing OpenCV with any other command missing the "contrib" phrase, it will not include some important libraries, eg: Face.
For raspberry pi 3B try this:
- try installing an older version by running this script on cmd line "sudo pip3 install opencv-contrib-python==3.4.6.27"
Getting an error on doing this: pi@raspberrypi:~ $ sudo pip3 install opencv-contrib-python==3.4.6.27 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting opencv-contrib-python==3.4.6.27 Downloading https://www.piwheels.org/simple/opencv-contrib-python/opencv_contrib_python-3.4.6.27-cp37-cp37m-linux_armv7l.whl (15.1 MB) |████████████ | 5.7 MB 11 kB/s eta 0:13:20 ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them. opencv-contrib-python==3.4.6.27 from https://www.piwheels.org/simple/opencv-contrib-python/opencv_contrib_python-3.4.6.27-cp37-cp37m-linux_armv7l.whl#sha256=c2bc36033b23aa8fb989ffa1b4e96e8beae005bc527f486d2a32982b5ea41925: Expected sha256 c2bc36033b23aa8fb989ffa1b4e96e8beae005bc527f486d2a32982b5ea41925 Got e4f9979c697cfa5009ff9f706420f18543ba1233739c79d08a90b43c09ecab25
Why don't you build it from source, that is the advisable installation for opencv in raspberry pi.
Tesfamichael Molla Ali
TME Education Ambassador in Ethiopia
hope.miky1074@gmail.com
admin@ethioaiandiotlab.info.et admin@ethioaiandiotlab.info.et
+251948246857
Bole, Kirkos sub-city, Addis Ababa
http://ethioaiandiotlab.info.et/
On Tue, Mar 10, 2020 at 9:56 PM davidmathew notifications@github.com wrote:
- "python3 -m pip install opencv-contrib-python" installs the latest version of OpenCV on the pi which isn't compatible with Raspberry pi 3b
- if you try installing OpenCV with any other command missing the "contrib" phrase, it will not include some important libraries, eg: Face.
For raspberry pi 3B try this:
- try installing an older version by running this script on cmd line "sudo pip3 install opencv-contrib-python==3.4.6.27"
Getting an error on doing this: pi@raspberrypi:~ $ sudo pip3 install opencv-contrib-python==3.4.6.27 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple Collecting opencv-contrib-python==3.4.6.27 Downloading https://www.piwheels.org/simple/opencv-contrib-python/opencv_contrib_python-3.4.6.27-cp37-cp37m-linux_armv7l.whl (15.1 MB) ████████████ 5.7 MB 11 kB/s eta 0:13:20 ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them. opencv-contrib-python==3.4.6.27 from https://www.piwheels.org/simple/opencv-contrib-python/opencv_contrib_python-3.4.6.27-cp37-cp37m-linux_armv7l.whl#sha256=c2bc36033b23aa8fb989ffa1b4e96e8beae005bc527f486d2a32982b5ea41925 Expected sha256 c2bc36033b23aa8fb989ffa1b4e96e8beae005bc527f486d2a32982b5ea41925 Got e4f9979c697cfa5009ff9f706420f18543ba1233739c79d08a90b43c09ecab25
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencv/opencv/issues/10516?email_source=notifications&email_token=AIKEWJD3T2XAVWYC7DQA22DRG2EMVA5CNFSM4EKQPHJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOMWNLY#issuecomment-597255855, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIKEWJG72ZMBLT6NEJJ7TKDRG2EMVANCNFSM4EKQPHJQ .
update your opencv by "python -m pip install opencv-contrib-python"
牛逼!确实好用! Niubi! That's really work!
i also have also this error but it is solved by this cmd pip install opencv-contrib-python or use pip install opencv-contrib-python --user
Installing opencv-contrib-python solved the issue. I had installed only opencv-python, After Installing opencv-contrib-python, solved the issue.
pip install opencv-contrib-python
If uou are using python3 use pip3 instead of using pip for: pip3 install opencv-contrib-python.
then you can simply do: recognizer = cv2.face.LBPHFaceRecognizer_create()
Help on module cv2.face in cv2:
NAME cv2.face
FILE (built-in)
FUNCTIONS StandardCollector_create(...) StandardCollector_create([, threshold]) -> retval
createBIF(...)
createBIF([, num_bands[, num_rotations]]) -> retval
createEigenFaceRecognizer(...)
createEigenFaceRecognizer([, num_components[, threshold]]) -> retval
createFisherFaceRecognizer(...)
createFisherFaceRecognizer([, num_components[, threshold]]) -> retval
createLBPHFaceRecognizer(...)
createLBPHFaceRecognizer([, radius[, neighbors[, grid_x[, grid_y[, threshold]]]]]) -> retval
Please check the commands because the repository keeps updating
Please check the commands because the repository keeps updating
no its a help command try it in python
its will give you the python contrib and how u have to type it for me its recognizer = cv2.face.createLBPHFaceRecognizer()
recoginizer = cv2.createLBPHFaceRecognizer() AttributeError: 'module' object has no attribute 'createLBPHFaceRecognizer'
if you have that error it means the face class is installed. but the updated version of opencv-contrib doesnt have 'createLBPHFaceRecognizer' it changed the name. so to find out print(help(cv2.face))
how do i get to do that?
Yeah for me it was the same cv2.face.createLBPHfaceRecognizer() and it worked for me around i guess 6 months ago after that i didn't use it much. So now i am not sure whether it's the same command or not.
File "02_face_training.py", line 21, in
and im using python 2.7.15
On Mon, May 11, 2020 at 7:16 AM U VAMSI KRISHNA notifications@github.com wrote:
Yeah for me it was the same cv2.face.createLBPHfaceRecognizer() and it worked for me around i guess 6 months ago after that i didn't use it much. So now i am not sure whether it's the same command or not.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/opencv/opencv/issues/10516#issuecomment-626474352, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIGXLV4V5KZ7DUEHOTZ7HPLRQ6CZTANCNFSM4EKQPHJQ .
I got an error when running opencv in Python on raspberry pi.
I tried to find and apply it to fix the error, but it did not work out. I also confirmed that the module "face" is in the file opencv_contrib-3.3.0. I do not know why for some reason.
error 1
Traceback (most recent call last): File "training.py", line 13, in
recognizer = cv2.face.createLBPHFaceRecognizer()
AttributeError: 'module' object has no attribute 'face'
error 2
Traceback (most recent call last): File "training.py", line 13, in
help(cv2.face)
AttributeError: 'module' object has no attribute 'face'
error3
Traceback (most recent call last): File "training.py", line 13, in
help(cv2.face.createLBPHFaceRecognizer)
AttributeError: 'module' object has no attribute 'face'
python : 3.5.3 opencv-3.3.0 opencv_contrib-3.3.0
source code
Import OpenCV2 for image processing
Import os for file path
import cv2, os
Import numpy for matrix calculation
import numpy as np
Import Python Image Library (PIL)
from PIL import Image
Create Local Binary Patterns Histograms for face recognization
recognizer = cv2.face.createLBPHFaceRecognizer()
Using prebuilt frontal face training model, for face detection
detector = cv2.CascadeClassifier("haarcascade_frontalface_default.xml");
Create method to get the images and label data
def getImagesAndLabels(path):
Get the faces and IDs
faces,ids = getImagesAndLabels('dataset')
Train the model using the faces and IDs
recognizer.train(faces, np.array(ids))
Save the model into trainer.yml
recognizer.save('trainer/trainer.yml')