Gender Age Facial prediction
Gender Age Facial prediction
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
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:
- Python3 library: opencv-python https://pypi.org/project/opencv-python/
- AWS account
Step 1:
Sign up an aws account and create iam user service (amazon rekogmition 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 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 in 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
Comments
Post a Comment