FERNet
Deep Learning based Facial Expression Recognition, 基于深度学习的面部表情识别
Install / Use
/learn @HaoliangZhou/FERNetREADME
FERNet
基于深度学习的面部表情识别 (Facial-expression Recognition)
一、项目背景
数据集cnn_train.csv包含人类面部表情的图片的label和feature。在这里,面部表情识别相当于一个分类问题,共有7个类别。<br>
其中label包括7种类型表情:<br>
<br>
一共有28709个label,说明包含了28709张表情包。<br>
每一行就是一张表情包4848=2304个像素,相当于4848个灰度值(intensity)(0为黑, 255为白)
二、数据预处理
1.标签与特征分离
cnn_feature_label.py<br> 对原数据进行处理,分离后分别保存为cnn_label.csv和cnn_data.csv.()
2.数据可视化
face_view.py<br> 对特征进一步处理,也就是将每个数据行的2304个像素值合成每张48*48的表情图,最后做成24000张表情包。
3.分割训练集和测试集
cnn_picture_label.py<br> Step1:划分一下训练集和验证集。一共有28709张图片,我取前24000张图片作为训练集,其他图片作为验证集。新建文件夹cnn_train和cnn_val,将0.jpg到23999.jpg放进文件夹cnn_train,将其他图片放进文件夹cnn_val.<br> Step2:对每张图片标记属于哪一个类别,存放在dataset.csv中,分别在刚刚训练集和测试集执行标记任务。<br> Step3:重写Dataset类,它是Pytorch中图像数据集加载的一个基类,需要重写类来实现加载上面的图像数据集 (rewrite_dataset.py)
三、搭建模型
CNN_face.py<br>
<div align="center"><img src="https://gitee.com/zhou-zhou123c/FERNet/raw/master/result/images/neural_network.jpg" width="800px" height="570px" alt="neural_network"></div>四、训练模型
train.py<br> 损失函数使用交叉熵,优化器是随机梯度下降SGD,其中weight_decay为正则项系数,每轮训练打印损失值,每5轮训练打印准确率。<br> <br>源数据放在CSDN
五、Star History
Related Skills
YC-Killer
2.7kA library of enterprise-grade AI agents designed to democratize artificial intelligence and provide free, open-source alternatives to overvalued Y Combinator startups. If you are excited about democratizing AI access & AI agents, please star ⭐️ this repository and use the link in the readme to join our open source AI research team.
best-practices-researcher
The most comprehensive Claude Code skills registry | Web Search: https://skills-registry-web.vercel.app
research_rules
Research & Verification Rules Quote Verification Protocol Primary Task "Make sure that the quote is relevant to the chapter and so you we want to make sure that we want to have it identifie
groundhog
398Groundhog's primary purpose is to teach people how Cursor and all these other coding agents work under the hood. If you understand how these coding assistants work from first principles, then you can drive these tools harder (or perhaps make your own!).
