ljchang commited on
Commit
936c232
1 Parent(s): 9365eae

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +33 -3
README.md CHANGED
@@ -2,16 +2,18 @@
2
  tags:
3
  - model_hub_mixin
4
  - pytorch_model_hub_mixin
 
 
5
  ---
6
 
7
  # ResMaskNet
8
 
9
  ## Model Description
10
- ResMaskNet is a convolutional neural network designed for robust face recognition and mask detection. It extends the ResNet architecture with specialized layers to handle masked face detection effectively. The model can distinguish between masked and unmasked faces and performs well even with variations in lighting, angles, and occlusions.
11
 
12
  ## Model Details
13
  - **Model Type**: Convolutional Neural Network (CNN)
14
- - **Architecture**: ResNet-based with custom mask detection layers
15
  - **Input Size**: 224x224 pixels
16
  - **Framework**: PyTorch
17
 
@@ -20,7 +22,7 @@ ResMaskNet is a convolutional neural network designed for robust face recognitio
20
  - **Paper**: [Facial Expression Recognition Using Residual Masking Network](https://ieeexplore.ieee.org/document/9411919)
21
 
22
  ## Citation
23
- If you use the ResMaskNet model in your research or application, please cite the following paper:
24
 
25
  Pham Luan, The Huynh Vu, and Tuan Anh Tran. "Facial Expression Recognition using Residual Masking Network". In: Proc. ICPR. 2020.
26
 
@@ -37,3 +39,31 @@ Pham Luan, The Huynh Vu, and Tuan Anh Tran. "Facial Expression Recognition using
37
 
38
  ## Acknowledgements
39
  We thank Luan Pham for generously sharing this model with a permissive license.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  tags:
3
  - model_hub_mixin
4
  - pytorch_model_hub_mixin
5
+ license: mit
6
+ library_name: pytorch
7
  ---
8
 
9
  # ResMaskNet
10
 
11
  ## Model Description
12
+ resmasknet combines residual masking with unet architecture to predict 7 facial emotion categories from images.
13
 
14
  ## Model Details
15
  - **Model Type**: Convolutional Neural Network (CNN)
16
+ - **Architecture**: Residual masking network with u-network. Output layer classifies 7 emotion categories
17
  - **Input Size**: 224x224 pixels
18
  - **Framework**: PyTorch
19
 
 
22
  - **Paper**: [Facial Expression Recognition Using Residual Masking Network](https://ieeexplore.ieee.org/document/9411919)
23
 
24
  ## Citation
25
+ If you use the svm_au model in your research or application, please cite the following paper:
26
 
27
  Pham Luan, The Huynh Vu, and Tuan Anh Tran. "Facial Expression Recognition using Residual Masking Network". In: Proc. ICPR. 2020.
28
 
 
39
 
40
  ## Acknowledgements
41
  We thank Luan Pham for generously sharing this model with a permissive license.
42
+
43
+ ## Example Useage
44
+
45
+ ```python
46
+ import numpy as np
47
+ import torch
48
+ import torch.nn as nn
49
+ from feat.emo_detectors.ResMaskNet.resmasknet_test import ResMasking
50
+ from huggingface_hub import hf_hub_download
51
+
52
+ device = 'cpu'
53
+ emotion_detector = ResMasking("", in_channels=3)
54
+ emotion_detector.fc = nn.Sequential(nn.Dropout(0.4), nn.Linear(512, 7))
55
+ emotion_model_file = hf_hub_download(repo_id='py-feat/resmasknet', filename="ResMaskNet_Z_resmasking_dropout1_rot30.pth")
56
+ emotion_checkpoint = torch.load(emotion_model_file, map_location=device)["net"]
57
+ emotion_detector.load_state_dict(emotion_checkpoint)
58
+ emotion_detector.eval()
59
+ emotion_detector.to(device)
60
+
61
+
62
+ # Test model
63
+ face_image = "path/to/your/test_image.jpg" # Replace with your extracted face image that is [224, 224]
64
+
65
+ # Classification - [angry, disgust, fear, happy, sad, surprise, neutral]
66
+ emotions = emotion_detector.forward(face_image)
67
+ emotion_probabilities = torch.softmax(emotions, 1)
68
+
69
+ ```