Skip to content

A ML project which can detect the gender and predict the age of the person on scanning the face from the image or in the live video .

Notifications You must be signed in to change notification settings

umangrathi110/Age_and_Gender_Detection

Repository files navigation

Age_and_Gender_Detection

Objective :

To build a gender and age detector that can approximately predicts the gender and age of the person on scanning the face from a picture or from the live video though camera(webcam).

About the Project :

In this Python Project, I had used Machine Learning to accurately identify the gender and age of a person from a single image of a face. I used the models trained by Tal Hassner and Gil Levi. The predicted gender may be one of ‘Male’ and ‘Female’, and the predicted age may be one of the following ranges- (0-5), (6-12), (13-18), (19-25), (28-34), (35,42), (43,50), (52,59), (60-100). It is very difficult to accurately guess an exact age from a single image because of factors like makeup, lighting, obstructions, and facial expressions

The contents of this Project :

  • opencv_face_detector.pbtxt
  • opencv_face_detector_uint8.pb
  • age_deploy.prototxt
  • age_net.caffemodel
  • gender_deploy.prototxt
  • gender_net.caffemodel
  • a few pictures to try the project on
  • detect.py

For face detection, we have a .pb file- this is a protobuf file (protocol buffer); it holds the graph definition and the trained weights of the model. We can use this to run the trained model. And while a .pb file holds the protobuf in binary format, one with the .pbtxt extension holds it in text format. These are TensorFlow files. For age and gender, the .prototxt files describe the network configuration and the .caffemodel file defines the internal states of the parameters of the layers.

How to use :

  • Download my Repository
  • Open your windows powershell or command prompt or Terminal and change directory to the folder where all the files of repository are present.
  • For detecting age and gender from the image :
  •   python test.py --image image_name
    

Note: The Image should be present in same folder where all the files are present

  • For detectig age and gender in the live video through webcam :
  •   python test.py
    
  • Press Ctrl + C or q to stop the program execution.

About

A ML project which can detect the gender and predict the age of the person on scanning the face from the image or in the live video .

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages