Question
Hello, I have a python code that detects emotions by using the FER library on python. however, it just rates the emotions not giving a
Hello, I have a python code that detects emotions by using the FER library on python. however, it just rates the emotions not giving a certain result. How can I select the emotion with the maximum probability?
before running the code don't forget to install FER and open cv libraries
import cv2 camera = cv2.VideoCapture(0) while True: return_value,image = camera.read() gray = cv2.cvtColor(image,cv2.COLOR_BGR2GRAY) cv2.imshow('image',gray) if cv2.waitKey(1)& 0xFF == ord('s'): cv2.imwrite('test.jpg',image) break camera.release() from fer import FER import matplotlib.pyplot as plt # img = plt.imread("test.jpg") detector = FER(mtcnn=True) # print(detector.detect_emotions(img)) # plt.imshow(img)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started