Souvikray / Drowsy-Driver-Alert-System

An application that can detect a driver drowsing by tracking the eye region and immediately alerts the driver.Additionaly in the event of a long inactivity, it will send sms to the driver's predefined contacts with his/her currrent location.
11 stars 3 forks source link

error AttributeError: module 'cv2.face' has no attribute 'LBPHFaceRecognizer_create #1

Open priyanka1221 opened 5 years ago

priyanka1221 commented 5 years ago

AttributeError Traceback (most recent call last)

in () 130 #face_recognizer = cv2.face.LBPHFaceRecognizer_create() 131 #recognizer = cv2.face.LBPHFaceRecognizer_create() --> 132 recognizer = cv2.face.LBPHFaceRecognizer_create() 133 face_recognizer.read("trainer.yml") 134 AttributeError: module 'cv2.face' has no attribute 'LBPHFaceRecognizer_create CV2 version = 3.3.0 tryied pip uninstall opencv-contrib-python pip install opencv-contrib-python please help to solve this
Souvikray commented 5 years ago

Maybe try this method cv2.face.createLBPHFaceRecognizer()

priyanka1221 commented 5 years ago

Maybe try this method cv2.face.createLBPHFaceRecognizer()

Hey, Tried with this method still getting the same error message. Any other solution

priyanka1221 commented 5 years ago

which CV2 version you were using to run this program

priyanka1221 commented 5 years ago

where is the trainner.yml file?

Souvikray commented 5 years ago

The trainer.yaml file is what the system uses to recognise or understand my face. You need to create your own trainer.yaml where you train the system with your own face. Check out my repositories below to learn more and create your own trainer.yaml

https://github.com/Souvikray/Realtime-Face-Recognition/blob/master/README.md

https://github.com/Souvikray/Eye-Blink-Detection/blob/master/README.md

Also I believe you are using a newer version of OpenCV because of which it is not understanding certain functions. Check out this blog which will install any missing modules https://www.talentica.com/blogs/opencv-with-extra-modules/

priyanka1221 commented 5 years ago

Hey, I somehow resolved the error I was getting with CV2 package. Now while executing the rest of the code its stuck in between, could you please help me out with this. I went through all the link provided by you, still not clear with how to create own YML file. I have to show demo tomorrow please help me to fix this.

Thanks,

Souvikray commented 5 years ago

If you really just want the system to detect drowsiness in a driver and not use face recognition, then you can choose to comment out that line and any reference made by it. The system will work fine without the face recognition too (that's what it needs the yaml file for.)

Here is the link for the code without face recognition feature https://www.codepile.net/pile/NKadw0v8

Now I couldn't test it since I did this project about an year back and I had a different computer back then. So my new system does't have opencv installed. Try out the code and let me know.

priyanka1221 commented 5 years ago

Hi, Thank you so much for your help. I tried to run code give in that link, but while executing it is getting stuck somewhere in between and not giving any output. Webcam light is on but the camera is not coming on screen.

I dont want face detection, only drowsiness s also fine with the sms and location. If you have any time can we have qick screen share so that I can show you the exact issue.

Thanks

Souvikray commented 5 years ago

Does it throw any errors in the console?

priyanka1221 commented 5 years ago

no error

Souvikray commented 5 years ago

By the way comment out line number 136. Then try to run it. If still doesn't work, then change line 193 to cap = cv2.VideoCapture(0) and see if that helps.

priyanka1221 commented 5 years ago

I tried both the methods, still same issue. the code is stuck in between, no error no output

Souvikray commented 5 years ago

This looks promising..it seems it solved the problem for most of the people https://stackoverflow.com/a/30928225/5550284

See if you can work this out.

Souvikray commented 5 years ago

By the way the line number 136 stays commented since it was meant for face recognition.

priyanka1221 commented 5 years ago

Still no help

Souvikray commented 5 years ago

Did you try out the steps mentioned in the link?

priyanka1221 commented 5 years ago

yes I followed the steps mentioned in link, but still the issue is same

Souvikray commented 5 years ago

still didn't workout?

priyanka1221 commented 5 years ago

Yes not working

On Mon 25 Feb, 2019, 12:43 AM Ray$$$, notifications@github.com wrote:

still didn't workout?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Souvikray/Drowsy-Driver-Alert-System/issues/1#issuecomment-466806823, or mute the thread https://github.com/notifications/unsubscribe-auth/As_qiEQrVLLiG8jgDps6hSUOheZfuSS9ks5vQuRIgaJpZM4bOAS- .