Table of contents
0 related information
Facial expression recognition 2: Pytorch realizes expression recognition (including expression recognition data set and training code): https://blog.csdn.net/guyuealian/article/details/129505205
B station video: https://www.bilibili.com/video/BV1xm4y1p7H3
1 Recognition method based on face detection + facial expression classification
Project source code: https://github.com/Whiffe/PyTorch-Facial-Expression-Recognition
Facial expression recognition consists of two parts: face detection and expression recognition classification
Face detection: https://github.com/Linzaer/Ultra-Light-Fast-Generic-Face-Detector-1MB
Expression recognition classification: common deep learning models such as resnet18, resnet34, resnet50, mobilenet_v2 and googlenet
2 project installation
2.1 Platform and image
I am a practical AutoDL platform
Mirror selection:
PyTorch 1.7.0
Python 3.8(ubuntu18.04)
Cuda 11.0
2.2 Project download
Project download:
git clone https://github.com/Whiffe/PyTorch-Facial-Expression-Recognition.git
If the network speed problem cannot be downloaded, I have already synchronized to the code cloud (recommended)
git clone https://gitee.com/YFwinston/PyTorch-Facial-Expression-Recognition.git
2.3 Model download
Model weight download ( latest-model-099-94.7200.pth ): https://download.csdn.net/download/WhiffeYF/88196455
Put the downloaded model in:
PyTorch-Facial-Expression-Recognition/data/pretrained/mobilenet_v2_1 .0_CrossEntropyLoss_20230313090258/model
Model weight download ( rfb-face-mask.pth ): https://download.csdn.net/download/WhiffeYF/88196487
Put the downloaded model in:
PyTorch-Facial-Expression-Recognition/libs/light_detector/data/pretrained /pth
2.4 Upload the picture to be tested
In this directory, upload the image to be detected:
PyTorch-Facial-Expression-Recognition/data/test_image
2.5 Project installation
Execute under the PyTorch-Facial-Expression-Recognition directory:
pip install -r requirements.txt
3 demo test
python demo.py --image_dir data/test_image --model_file data/pretrained/mobilenet_v2_1.0_CrossEntropyLoss_20230313090258/model/latest_model_099_94.7200.pth --out_dir output/
The test results are as follows: