Gender- Age- Beard- Eye glass prediction using computer vision and aws

Published Aug 03, 2020
 3 hours to build
 Beginner

The project idea was implemented using OpenCV-Python and AWS. The aim was to predict the gender, age, and other facial features of the image or frame in a video.

display image

Components Used

PC- windows or linux
1
Description

The project idea was implemented using OpenCV-Python and aws.

The aim was to predict the gender, age, and other facial features of the image or frame in a video.

Requirements:

Step 1:

        Sign up an AWS account and create IAM user service (amazon recognition and amazon bucket s3) enabled.

        Once created IAM user account download credential.csv file and copy the file to your folder location. (Note don't share your credential to anyone)
 

Step 2:

         write a python program to capture the video using a webcam.

           Read the credential file to your program and read aws_access_key_id and aws_secret_access_key.

with open("new_user_credentials.csv",'r') as input:
    next(input)
    reader=csv.reader(input)
    print(reader)

    for line in reader:
        access_key_id=line[2]
        secret_key_id=line[3]

 

Step 3:

       AWS API request and response is integrated into your program 


photo="test.jpg"
region = "eu-west-1"
client = boto3.client("rekognition", aws_access_key_id=access_key_id,
                      aws_secret_access_key=secret_key_id, region_name=region)

response = client.detect_faces(
    Image={
        'Bytes': photo
    },
    Attributes=[
        'ALL'
    ]
)

 

Step 4:

        Response data is a dictionary and we have to split the data based on our requirements.

 

Step 5:

        cv2.puttext - display text in frame

        cv2.rectange - draw rectangle in particular portion

        cv2.imshow - to show/display the frame

 

For more such interesting projects, visit my Blog: https://ai-computervision-nlp.blogspot.com/2020/07/gender-age-facial-prediction.html

Codes

Institute / Organization

Maria College of Engineering and Technology, Anna University-Chennai
Comments
Ad