How to add Facial Detection and Facial Recognition in your AI/Chatbot.
How to add Facial Detection and Facial Recognition in your AI/Chatbot.
So, ever felt that ‘I want my AI to recognise me’. Well there is a library called opencv in python that lets you just that.
So for starters you will need your own AI/Chatbot if you don’t have one see my article on how to make one using tensor flow and deep learning:
Firstly lets get started with the imports:-medium.com
So, for facial recognition we need facial detection first. Lets get started with the facial detection part.
First the imports:
Now lets detect faces and save the faces along with the name of the recognised face for further trainig:
Now lets capture and save the faces in a local folder:
Now the facial recognition and directory making part is finished.
Now let's get started with the second code that will take this faces and train itself to recognise them.
Lets get started with the imports:
Next up reading the training images and classes and storing into the corresponding lists:
Now lets encode faces from train images:
Lets detect and encode faces from our webcam input:
Lets find the matches between the detected faces and the Training images face:
Now the easiest part drawing the detection and show the identity of the person:
And just like that our facial recognition code is done now just load up images and enjoy.
Now lets try it with my AI named ‘DEW’ but for that we gotta make the above code a function which is pretty easy just add this and add indentation to the whole code :
Now with just addition of 2 lines of code in line number 18 and 96 our AI now has Facial Recognition!!
Lets see the output:
If you liked this article a follow would be appreciated 😁
If you wanna see more of my codes here is my Github:
You can't perform that action at this time. You signed in with another tab or window. You signed out in another tab or…github.com
For my day to day updates of my AILM research follow me on twitter:
Thanks for reading 😁
happy coding
See ya soon