OpenCV Python TUTORIAL #4 for Face Recognition and Identification 1

OpenCV Python TUTORIAL #4 for Face Recognition and Identification



OpenCV with Python Series #4 : How to use OpenCV in Python for Face Recognition and Identification

Sections
Welcome (0:00:00)
Copy Haar Cascades (0:04:27)
Haar Cascades Classifier (0:07:11)
Using the Face Classifier (0:09:36)
Draw a Rectangle in OpenCV (0:16:15)
Recognizer (0:20:13)
os.walk for image finding (0:23:25)
Labels from directories (0:27:45)
Training image into a numpy array (0:31:04)
Region of Interest in Training Data (0:34:06)
Creating Training Labels (0:37:06)
Using Pickle to Save Label IDs (0:40:38)
Train the OpenCV Recognizer (0:42:20)
Implement Recognizer (0:44:28)
Load Label Names from Pickle(0:47:46)
OpenCV PutText (0:53:02)
Resize Images for Training (0:54:35)
Eyes and Smile (0:58:01)
Live Tests (1:00:46)
Final thoughts (1:02:23)

Subscribe: http://kirr.co/7l2sv4/
Code on Github: http://joincfe.com/github/

New to OpenCV? Try this: https://youtu.be/YY9f-6u2Q_c

Learn OpenCV & Python Playlist: https://www.youtube.com/playlist?list=PLEsfXFp6DpzRyxnU-vfs3vk-61Wpt7bOS

Install OpenCV for Python on your system:
Mac: https://youtu.be/iluST-V757A
Windows: https://youtu.be/Fcc_jemaoNU
Linux with Pi Awesome: https://kirr.co/sx77b7

NEW!! Slack Channel: https://kirr.co/n7xgvn

source

50 Comments

  1. I am able to print the image_array, but faces is giving empty values when i use the detectMultiScale . please suggest

  2. how can we train on just one single image?

  3. Hi,<br />I am trying to build an RFID based facial recognition system.<br />could you assist with the connection of RFID and laptop using python?

  4. Thank you, sir, awesome video.

  5. Is this dnn approach?

  6. Traceback (most recent call last):<br /> File "PycharmProjects/opencv/src/<a href="http://faces.py/">faces.py</a>", line 5, in <module><br /> recognizer = cv2.face.LBPHFaceRecognizer_create()<br />AttributeError: module 'cv2.cv2' has no attribute 'face'<br /><br /><br />I'm really tired of it, please help anybody in solving it.<br />Thanks

  7. good teching

  8. need to ask for attendance management system, do you have any code that can write immediately in the database/excel before using cam release () function......because the thing is keeping the system alive for longer hours will finish up the buffer ~RAM and will surely degrade the speed.........So is there any code that can be used to write the attendance immediately after detecting

  9. if anyone having problem with this error > Traceback (most recent call last):<br />File "<a href="http://tellotv.py/">tellotv.py</a>", line 46, in<br />recognizer = cv2.face.LBPHFaceRecognizer_create()<br />AttributeError: module 'cv2.cv2' has no attribute 'face'<br /><br /><br />then here is the solution ><br />on terminal write ><br /><br />pip install opencv-contrib-python --upgrade<br />if gives error then<br />write<br />pip install opencv-contrib-python --user<br />it will work fine for cv2.face.LBPHFaceRecognizer_create();

  10. Which python version u r using<br />I m lacking some attributes in opencv

  11. how can we use this in android.

  12. how do i use train method from recognizer but with a few attributes?

  13. This code is also not present in your account

  14. Where i should put code for this scenario : if Justin then store some data like time and date, and start other functions.

  15. Just a question, Can I count the uniques faces that there is in a video? How it will recognize that a face that appear is start of the video is the same with the face that appear by the end of the video?

  16. Sir my program is not run plz hel

  17. Very awesome video, it helped me a lot

  18. I'm just thinking how this algorithm to use in Wood Identification process? Is there anyone could help me?

  19. When I run the recognizer it shows cv2.cv2 has no attribute "face", what should I do pls help somebody🥺

  20. Bro in python 3.7 recognizer module is not available pls help me

  21. i am getting this type of error please help me out...<br /><br /><br /> recognizer.train(x_train,np.array(y_labels))<br />TypeError: src is not a numpy array, neither a scalar

  22. This subject is a can of worms for me it reminds me of a future orwellian state and big brother watching. Just saying....

  23. <a href="https://www.youtube.com/watch?v=PmZ29Vta7Vc&t=54m05s">54:05</a> funny typo xD muscle memory i guess :P

  24. You speech is very clear, every word every sentence. I think the speed is very good.<br />Because I'm Chinese, but I can understand what you say from the subtitle. It's very good for me. <br />Thanks

  25. This really good tutorial and my project are almost perfect, just the problem is when the camera detects my face, my name is not come out, sometimes when I use more than 3 models, the system looks like crazy, it cannot recognize our face properly.<br /><br /><br />I hope you a solution to this problem, to make the recognizer more accurate.<br />Thank you.

  26. Is that work on raspberry pi?

  27. cant go there /usr/lib/python3/dist-packages/<a href="http://cv2.cpython-37m-arm-linux-gnueabihf.so/">cv2.cpython-37m-arm-linux-gnueabihf.so</a> it said doesnt exist

  28. hi CodingEntrepreneurs , can you help me with this error<br /><br /><br /> with open("pickles/face-labels.pickle", 'wb') as f:<br /><br />FileNotFoundError: [Errno 2] No such file or directory: 'pickles/face-labels.pickle'<br /><br /><br />other code are fine but face code can not play

  29. what program do you use to code it?

  30. salam allah alaikum <br />my problem is when i add my images to images folder and run the trainer the <a href="http://face.py/">face.py</a> says thats i'am Justine hhhhh<br />please help me<br />thanks

  31. Thanks, very well organised and teached

  32. If we want to redirect to an URL after recognised a particular emotion how can we take a step forward? In which code we have to add redirecting code?

  33. who is better to add images to images folder with high reselution or low one ?

  34. who is better to add images to images folder with high reselution or low one ?

  35. Thank you man its so helpful!

  36. Thank for inspiring me, put a smile on my face, subscribed!!

  37. Hi, is this possible in Xamarin.Forms?

  38. hands down the best tutorial thus far!

  39. Hello sir, can i use this code for object recognition? or it only works for face recognition?

  40. It says '__file__' is not defined, please help

  41. man, you are my first teacher in openCV, Thanks. How can i count the number of people with the camera?

  42. Thank you So Much sir For this Tutorial,it's helped me a lot

  43. i'm getting "AttributeError: module 'cv2.cv2' has no attribute 'face' " error ....provide a solution for this error

  44. awesome video... really good and working just perfect.. no issues no problems.... thanks bro.. <br /><br />can we use more acurate models-_? like already trained object detectors and face recognitions.

  45. attribute error module has no attribute 'cv2.face.LBPHFaceRecognizer'

  46. what version of python are you using

  47. I couldn't thank you more for building this tutorial, you have my respect and all the well wishes, thanks a lot justin, god bless you. Love from India..!!!!!

  48. Nice work bro !!!

  49. Great tutorial Justin. Thank you.

  50. Deep learning is not the way to go forward on face recognition; assuming you often update the database, with new people coming in others going out, then it’s not sustainable. <br /><br />You want a Euclidean distance model for each new face. Which measures vector relations between facial features, like distance between eyes and the width of an eye, the vector between corner of the both and the eye. That allows you to add a new face to your database without having to retrain the whole network and having the risk of overtraining. <br />We use this in a penitentiary for illegals aliens, who are legal not inmates in our country’s so they can roam in the institution. But some times their councilor, ICE agent or lawyer comes and then it was impossible to find the person and guards had to be send out to looking for the person.<br />Now we track the people with webcams in the building and we can generally find them with about 70% accuracy. So it only takes one guard to walk to the room where the face was last detected.<br />They problem we have is that these images are shot from far away with a wide lens. And majority of these people are black so it’s difficult to have enough contrast to measure the Euclidean vectors when they just roam about. With the Asians and Caucasian people, the success rate is about 85-90%<br />An advantage that we have is that we have to take pictures of the person for adminstrative purposes. So we have a good set of reference images to extract the features and measure The Euclidean vectors.

Leave a Reply

Your email address will not be published. Required fields are marked *