Progressive Teacher: [Boosting Facial Expression Recognition by A Semi-Supervised Progressive Teacher](https://scholar.google.com/citations?view_op=view_citation&hl=zh-CN&user=OCwcfAwAAAAJ&citation_for_view=OCwcfAwAAAAJ:u5HHmVD_uO8C)
Note:
- Progressive Teacher is contributed by [Jing Jiang](https://scholar.google.com/citations?user=OCwcfAwAAAAJ&hl=zh-CN).
-[MobileFaceNet](https://link.springer.com/chapter/10.1007/978-3-319-97909-0_46) is used as the backbone and the model is able to classify seven basic facial expressions (angry, disgust, fearful, happy, neutral, sad, surprised).
-[facial_expression_recognition_mobilefacenet_2022july.onnx](https://github.com/opencv/opencv_zoo/raw/master/models/facial_expression_recognition/facial_expression_recognition_mobilefacenet_2022july.onnx) is implemented thanks to [Chengrui Wang](https://github.com/opencv).
Results of accuracy evaluation on [RAF-DB](http://whdeng.cn/RAF/model1.html).
| Models | Accuracy |
|-------------|----------|
| Progressive Teacher | 88.27% |
## Demo
***NOTE***: This demo uses [../face_detection_yunet](../face_detection_yunet) as face detector, which supports 5-landmark detection for now (2021sep).
Run the following command to try the demo:
```shell
# recognize the facial expression on images
python demo.py --input /path/to/image
```
### Example outputs
Note: Zoom in to to see the recognized facial expression in the top-left corner of each face boxes.
![fer demo](./examples/selfie.jpg)
## License
All files in this directory are licensed under [Apache 2.0 License](./LICENSE).
help_msg_backends="Choose one of the computation backends: {:d}: OpenCV implementation (default); {:d}: CUDA"
help_msg_targets="Chose one of the target computation devices: {:d}: CPU (default); {:d}: CUDA; {:d}: CUDA fp16"
try:
backends+=[cv.dnn.DNN_BACKEND_TIMVX]
targets+=[cv.dnn.DNN_TARGET_NPU]
help_msg_backends+="; {:d}: TIMVX"
help_msg_targets+="; {:d}: NPU"
except:
print('This version of OpenCV does not support TIM-VX and NPU. Visit https://github.com/opencv/opencv/wiki/TIM-VX-Backend-For-Running-OpenCV-On-NPU for more information.')
parser.add_argument('--input','-i',type=str,help='Path to the input image. Omit for using default camera.')
parser.add_argument('--model','-fm',type=str,default='./facial_expression_recognition_mobilefacenet_2022july.onnx',help='Path to the facial expression recognition model.')
parser.add_argument('--save','-s',type=str,default=False,help='Set true to save results. This flag is invalid when using camera.')
parser.add_argument('--vis','-v',type=str2bool,default=True,help='Set true to open a window for result visualization. This flag is invalid when using camera.')