🚀 ResMaskNet
ResMaskNet结合了残差掩码和U-Net架构,可从图像中预测7种面部情绪类别,为面部表情识别提供了有效的解决方案。
🚀 快速开始
以下是使用ResMaskNet进行面部情绪分类的示例代码:
import numpy as np
import torch
import torch.nn as nn
from feat.emo_detectors.ResMaskNet.resmasknet_test import ResMasking
from huggingface_hub import hf_hub_download
emotion_config_file = hf_hub_download(repo_id= "py-feat/resmasknet", filename="config.json", cache_dir=get_resource_path())
with open(emotion_config_file, "r") as f:
emotion_config = json.load(f)
device = 'cpu'
emotion_detector = ResMasking("", in_channels=emotion_config['in_channels'])
emotion_detector.fc = nn.Sequential(nn.Dropout(0.4), nn.Linear(512, emotion_config['num_classes']))
emotion_model_file = hf_hub_download(repo_id='py-feat/resmasknet', filename="ResMaskNet_Z_resmasking_dropout1_rot30.pth")
emotion_checkpoint = torch.load(emotion_model_file, map_location=device)["net"]
emotion_detector.load_state_dict(emotion_checkpoint)
emotion_detector.eval()
emotion_detector.to(device)
face_image = "path/to/your/test_image.jpg"
emotions = emotion_detector.forward(face_image)
emotion_probabilities = torch.softmax(emotions, 1)
✨ 主要特性
- 结合残差掩码和U-Net架构,用于面部情绪分类。
- 能够从图像中准确预测7种面部情绪类别。
📚 详细文档
模型描述
ResMaskNet结合了残差掩码和U-Net架构,可从图像中预测7种面部情绪类别。
模型详情
属性 |
详情 |
模型类型 |
卷积神经网络 (CNN) |
架构 |
带有U-Net的残差掩码网络,输出层对7种情绪类别进行分类 |
输入尺寸 |
224x224像素 |
框架 |
PyTorch |
模型来源
引用
如果您在研究或应用中使用了svm_au模型,请引用以下论文:
Pham Luan, The Huynh Vu, and Tuan Anh Tran. "Facial Expression Recognition using Residual Masking Network". In: Proc. ICPR. 2020.
@inproceedings{pham2021facial,
title={Facial expression recognition using residual masking network},
author={Pham, Luan and Vu, The Huynh and Tran, Tuan Anh},
booktitle={2020 25th International Conference on Pattern Recognition (ICPR)},
pages={4513--4519},
year={2021},
organization={IEEE}
}
致谢
我们感谢Luan Pham以宽松的许可证慷慨分享此模型。
📄 许可证
本模型使用MIT许可证。