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
Get step-by-step solutions from verified subject matter experts
