Sunday, December 22, 2024

Smart AI Robot With Gender Recognition Using Voice

ashwini“Robot With Smart Sense its can now recognise your gender even if it is not seeing you can”

“We humans have extraordinary capability through which we can recognise estimate the gender without seeing the face or body of person just by listening to persons voice”

Previously we have made a smart robot that can recognize the face but be human and have some extraordinary capability that is not available in any robot. The smart AI robot can recognise the face as well as can detect the age and gender of the person using the voice of person, the robot now does not need to see the face and body of the person to recognise them, it can now sense the gender and person using the voice tone.

- Advertisement -

So let’s start the project with a collection of the following components. Here you can find the components from the previous version of the robot.

- Advertisement -

Next, you have to assemble the robot as described in the article then we have to start working on this version of the robot.

Bill Of Materials

Construction

First of all, we need to assemble the robot face as in the previous version of the article. Then we have to and the voice bonnet to the robot.

Next, we have to safely remove the RPI4 board and then Attach the AIY Voice bonnet on the Raspberry Pi 4 keeping in mind the pins matching each other on raspberry pi and bonnet.

Next, we have to attach the speakers to the speaker out pin of Raspberry Pi Bonnet.

Now we are ready to use the Raspberry Pi Voice Bonnet On Our Smart AI Robot.

Now Both the Raspberry Pi on the robot and then Open the Linux terminal and install the required Modules and library into the Raspberry Pi. We already have installed the following library in the previous version of the robot.

  • Tensorflow
  • OpenCV
  • Dlib
  • Keras

Here we need to install few extra library from previous version using the following commands

sudo pip3 install pyaudio
sudo pip3 install speechrecognition
sudo  pip3 install voicegender

After install of the above libraries, we are now all set for the coding part

Coding

Open the Python IDLE and then code as following:

First, we have to import the required library and modules in code.  Here we have imported the time, threading for multiple processing like we need to record the audio and check the but push at the same time then we need to import the espeak for speech synthesis and the aiy board library to access the aiy board recording and playback function. Next for recognition of voice and sensing the gender of the person we import the voice gender library in the code

After that, we have defined the filename where we temporarily save the person’s voice so that we can process them as per our need.

After that we will create the main function where we create the code that checks the button press event on bonnet if it detects the press of a button then it will automatically start the voice recording function and record the users’ voice until the next button press event and then it saves the voice recorded in the test.wav file after that it calls the voice gender function that process the audio and then classify the audio tone as male and female and then using espeak it will tell if the speaker is male or female and also play back the audio.

Testing

Now save the code and run the code then press the button on bonnet and say hello or anything and then again press the button on the bonnet and wait a few seconds the robot strat speaking to you and tells you your gender is male or female and playback your recorded audio as well. So here it is our smart AI robot that can recognise us and our gender just like we Humans and tell us about our gender.

Ashwini Sinha
Ashwini Sinha
A tech journalist at EFY, with hands-on expertise in electronics DIY. He has an extraordinary passion for AI, IoT, and electronics. Holder of two design records and two times winner of US-China Makers Award.

4 COMMENTS

SHARE YOUR THOUGHTS & COMMENTS

EFY Prime

Unique DIY Projects

Truly Innovative Electronics

Electronics News

Latest DIY Videos

Electronics Components

Electronics Jobs

Calculators For Electronics