🚀 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許可證。