I wanted to implement a simple form of artificial intelligence, which is a field that has always interested me. OpenCV was a great starting point to understand AI and implement it into a program.

What it does

It accesses the camera of the computer and identifies the face of the person with a box. It also identifies an approximate age and gender of the person being shown.

How I built it

I used the argparse library to create an argument parser, so we can get the image argument from the command prompt. I then parsed the contention holding the way to the picture to classify gender and age for. For the face, age, and gender, I initialized protocol buffer and model and classified the age/gender into one of the 8 age ranges, and initialize the mean values for the model and the lists of age ranges and genders to classify from. Next, I load the networks for network configuration and trained weight. Finally, I captured a video stream, fed the input/information and give the system a forward go to get the certainty of the two classes, and added the gender and age texts to the final image.

Challenges I ran into

I had to determine the mean values variable in order to accurately measure the age and gender of the subject. I had to use a lot of trial and error in order to determine a good mean value variable to include in my program.

Accomplishments that I'm proud of

I was able to run the identification process in real-time, instead of taking a photo. This will make it easier to implement this program in the future. If I wanted to work this program into a computer or phone application, it would be better to access the camera instead of using a photo.

What I learned

I learned how to access the argparse library and how to implement given databases to make predictions concerning large pieces of information.

What's next for Gender and Age Face Detection

I hope to implement this code into an application on computers and phones in the future. I also want to fix the error where the camera feed freezes up if there is no face to analyze in the camera's view. Finally, the AI and database behind the program can always be improved and made more accurate with machine learning.

Built With

Share this project: