PRACTICAL - 10
AIM: Using image data, predict the gender and age range of an individual in Python. Test the data science model using your own image.
THEORY:
Age and gender, two of the key facial attributes, play a very foundational role in social interactions, making age and gender estimation from a single face image an important task in intelligent applications, such as access control, human-computer interaction, law enforcement, marketing intelligence and visual surveillance, etc.
Here, we have performed Gender Detection i.e predicting ‘Male’ or ‘Female’ using deep learning libraries and OpenCV to mention the gender predicted.
Age detection is the process of automatically discerning the age of a person solely from a photo of their face.
Age detection implemented as a two-stage process:
In following two parts we can do these:-
1 Detect faces from input image
2. Extract the face Region of Interest (ROI), and apply the age detector algorithm to predict the age of the person
And it can be done in by following:-
- IMPORT LIBRARIES
- LOADING MODEL & WEIGHT FILES
- GENDER & AGE LIST
- ageList = ['(0-2)', '(4-6)', '(8-12)', '(15-20)', '(25-32)', '(38-43)', '(48-53)', '(60-100)']genderList = ['Male', 'Female']
ageNet.setInput(blob)
agePreds = ageNet.forward()
age = ageList[agePreds[0].argmax()]
print("Age Output : {}".format(agePreds))
print("Age : {}, conf = {:.3f}".format(age, agePreds[0].max()))
Comments
Post a Comment