How to add emotion recognition to your AI/Chatbot

So, Ever wonder how would it feel if your AI could understand your emotions to a physical extent. Honestly No 🤣, But can't hurt to try…

How to add emotion recognition to your AI/Chatbot

So, Ever wonder how would it feel if your AI could understand your emotions to a physical extent. Honestly No 🤣, But can't hurt to try right. So, I did try and succeeded to some extent.

If you don’t already have a AI/Chatbot Setup read my article on how to make one:

Let's see how it’s done.

Like all python codes lets start with the imports first:

As you can see we will be using cv2 for image processing and deepface library for facial tracking.

Now lets get the harrcascade xml file and processing it for our work:

Lets check for webcam inputs and use it:

Let’s make our video input greyscale cuz it makes it very easy to process the video file:

Now lets track the face and make rectangle on the face and use deepface to detect the dominant emotion:

Lets now just print the output and stop the loop accordingly:

The code is finished as easy as that!!

Lets impliment it in my AI called ‘DEW’:

the code

As you can see just with two lines of code in line number 17 and 112 our AI has emotion recognition now.

Lets see some results 😁

Processing
Processing
The input
The output 🤣

Thanks for reading 😁

Have fun coding :) , Follow for more fun AI stuff 😁

Check out my Github for more stuff:

Follow me on twitter for my day to day AIML research updates:

Thanks for reading :) , See ya next time.