但是表情识别很难,因为人脸的微表情很多,本节介绍一种比较粗线条的表情分类与识别的办法。...理论略过,直接来看重点:
(1)加载人脸检测器,haarcascade_frontalface_default.xml;
(2)图片加载并灰化,cvtColor,可参考: opencv︱图像的色彩空間...是利用Keras实现的。...# cv2.imwrite(str(index)+'.png', resized_img)
image = resized_img.reshape(1, 1, 48, 48)
list_of_list...model.predict(image, batch_size=1, verbose=1)
angry, fear, happy, sad, surprise, neutral = [prob for lst in list_of_list