参考网址:https://sefiks.com/2018/01/01/facial-expression-recognition-with-keras/
1.数据集介绍及处理:
(1) 数据集Fer2013下载地址为:https://www.kaggle.com/c/challenges-in-representation-learning-facial-expression-recognition-challenge/data
该数据集中每张图片的像素为48*48,该数据集用excel读取后显示的格式如下图所示:
第一列为标签(也即为什么表情),第二列为像素值,第三列是代表该图片是训练集还是测试集,已经给你打乱了。只需要用即可
(2)pandas读取数据集
import numpy as np import pandas as pd data = pd.read_csv(\'data/fer2013/fer2013.csv\') num_of_instances = len(data) #获取数据集的数量 print("数据集的数量为:",num_of_instances) pixels = data[\'pixels\'] emotions = data[\'emotion\'] usages = data[\'Usage\']