phamquiluan commited on
Commit
3b39ad6
·
verified ·
1 Parent(s): 62d9959

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +75 -0
README.md ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: mit
3
+ pipeline_tag: image-classification
4
+ tags:
5
+ - facial-expression-recognition
6
+ - emotion-recognition
7
+ - fer2013
8
+ - pytorch
9
+ library_name: pytorch
10
+ ---
11
+
12
+ # Residual Masking Network (RMN) — Facial Expression Recognition
13
+
14
+ Official checkpoint for **"Facial Expression Recognition using Residual Masking Network"** (ICPR 2020).
15
+
16
+ - 📄 Paper: [IEEE Xplore](https://ieeexplore.ieee.org/abstract/document/9411919)
17
+ - 💻 Code: [github.com/phamquiluan/ResidualMaskingNetwork](https://github.com/phamquiluan/ResidualMaskingNetwork)
18
+ - 🏆 State-of-the-art single-model accuracy on FER2013: **74.14%** (76.82% with ensemble)
19
+
20
+ ## Files
21
+
22
+ | File | Description |
23
+ |---|---|
24
+ | `Z_resmasking_dropout1_rot30_2019Nov30_13.32` | Training checkpoint of the `resmasking_dropout1` architecture used by the [`rmn`](https://pypi.org/project/rmn/) pip package. Model weights are stored under the `"net"` key. |
25
+ | `face_detection_yunet_2023mar.onnx` | YuNet face detector used by the `rmn` package pipeline. |
26
+
27
+ ## Usage
28
+
29
+ The easiest way is through the `rmn` package:
30
+
31
+ ```bash
32
+ pip install rmn
33
+ ```
34
+
35
+ ```python
36
+ import cv2
37
+ from rmn import RMN
38
+
39
+ m = RMN()
40
+ image = cv2.imread("some-image.png")
41
+ results = m.detect_emotion_for_single_frame(image)
42
+ print(results)
43
+ ```
44
+
45
+ Or load the raw checkpoint directly:
46
+
47
+ ```python
48
+ import torch
49
+ from huggingface_hub import hf_hub_download
50
+ from models import resmasking_dropout1 # from the GitHub repo
51
+
52
+ path = hf_hub_download(
53
+ repo_id="phamquiluan/ResidualMaskingNetwork",
54
+ filename="Z_resmasking_dropout1_rot30_2019Nov30_13.32",
55
+ )
56
+ model = resmasking_dropout1(in_channels=3, num_classes=7)
57
+ state = torch.load(path, map_location="cpu")
58
+ model.load_state_dict(state["net"])
59
+ model.eval()
60
+ ```
61
+
62
+ Emotion labels (FER2013): `angry, disgust, fear, happy, sad, surprise, neutral`.
63
+
64
+ ## Citation
65
+
66
+ ```bibtex
67
+ @inproceedings{pham2021facial,
68
+ title={Facial expression recognition using residual masking network},
69
+ author={Pham, Luan and Vu, The Huynh and Tran, Tuan Anh},
70
+ booktitle={2020 25th International Conference on Pattern Recognition (ICPR)},
71
+ pages={4513--4519},
72
+ year={2021},
73
+ organization={IEEE}
74
+ }
75
+ ```