我正在运行面部表情识别,它实时给出预测的表情。目前,它将显示从视频中识别出的面部表情。
这段代码在一个For循环中。
predictions = model.predict(img_pixls)
#index array 0: angry, 1:disgust, 2:fear, 3:happy, 4:sad, 5:surprise, 6:neutral
index = np.argmax(predictions[0])
Based on the returns I will be getting the index as it predicts each facial expression.
我如何允许系统运行,比方说一段时间,并根据正和负对读数的出现次数进行分组?我想把0,1,2,4归为负,3,5,6归为正。如果实时读数是(4,4,3,1,0,3,3,6,6,6),我希望系统在按enter键暂停For循环并在再次按enter键时继续读取后,根据读数是更正还是更负来返回结果。
4 (2),
3 (3)
1 (1)
0 (1)
6 (3)
Positive (6) Negative (4)
谢谢!
发布于 2019-12-16 16:41:55
你可以这样做
pos_list = 3,5,6 neg_list = 0,1,2,4
Then: overall_score =0 if index in pos_list: score +=1 if index in neg_list: score -=1
然后循环遍历所有返回的索引
返回分数最终会给你一个正值、零值或负值。
https://stackoverflow.com/questions/59352862
复制相似问题