Python 实时编译面部表情识别结果
我正在运行面部表情识别,它可以实时给出预测的表情。目前,它将显示从视频中识别出的面部表情 此代码位于For循环下Python 实时编译面部表情识别结果,python,Python,我正在运行面部表情识别,它可以实时给出预测的表情。目前,它将显示从视频中识别出的面部表情 此代码位于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
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),我希望系统在按下enter键暂停For循环并再次按下enter键时继续读取后,根据读数是否为正返回结果
4 (2),
3 (3)
1 (1)
0 (1)
6 (3)
Positive (6) Negative (4)
谢谢 你可以做如下事情 位置列表=[3,5,6] 负列表=[0,1,2,4] 然后: 总体得分=0 如果位置列表中有索引: 分数+=1 如果索引位于neg_列表中: 分数-=1 然后循环遍历所有返回的索引 返回分数最终会给你一个正值、零值或负值