Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Foundations of AI Applications Lab

Prepared By: Divneet Singh Kapoor & Kiran Jot Singh

HOME TASK
EXPERIMENT – 3
CLASS-CSE9(B)
GROUP MEMBER’S DETAIL:
NAMES:
 Aman Singh
 Sudhanshu Singhal
 Shaurya Yadav
 SIDDHARTHA KUMAR
 Aman Kumar Nishad

Aim:

Derive insights from images in the cloud using pre-trained Vision API
models to detect facial emotions.
Requirements: PC with internet connectivity, Python 3.7

Requirements:

PC with internet connectivity,


• Anaconda
• Python 3.7
• Visual studio
• Windows 7 or higher
• Open cv
Foundations of AI Applications Lab

Prepared By: Divneet Singh Kapoor & Kiran Jot Singh

Code:

import os
path = r'C:\Users\hp\.spyder-py3\New folder'
os.environ['PATH']+=':'+path

from deepface import DeepFace


from PIL import Image
import cv2
import matplotlib.pyplot as plt

img_path = 'aman.jpg'
img = cv2.imread(img_path)
plt.imshow(img[:, :, ::-1])

image = Image.open(img_path)
image.show()
demography = DeepFace.analyze(img_path)

print("Age: ", demography["age"])


print("Gender: ", demography["gender"])
print("Emotion: ", demography["dominant_emotion"])
print("Race: ", demography["dominant_race"])
Foundations of AI Applications Lab

Prepared By: Divneet Singh Kapoor & Kiran Jot Singh

USED IMAGE
Foundations of AI Applications Lab

Prepared By: Divneet Singh Kapoor & Kiran Jot Singh

OUTCOME:

You might also like