ArcFace 模型介绍
人脸属性模型FairFace
模型描述
MogFace为当前SOTA的人脸检测方法,已在Wider Face六项榜单上霸榜一年以上,后续被CVPR2022录取(论文地址,代码地址),该方法的主要贡献是从下面三个角度提升人脸检测器:
- Scale-level Data Augmentation (SSE):SSE是第一个从maximize pyramid layer 表征的角度来控制数据集中gt的尺度分布,而不是intuitive的假想检测器的学习能力,因此会在不同场景下都很鲁棒。
- Adaptive Online Anchor Mining Strategy(Ali-AMS):减少对超参的依赖, 简单且有效的adpative label assign 方法。
- Hierarchical Context-aware Module (HCAM): 减少误检是real world人脸检测器面对的最大挑战,HCAM是最近几年第一次在算法侧给出solid solution。
MogFace在WiderFace榜单上的指标如下:
模型效果
![模型效果]()
模型使用方式和使用范围
本模型可以检测输入图片中人的性别和年龄范围:[0-2, 3-9, 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70+]。
代码范例
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
mog_face_detection_func = pipeline(Tasks.face_detection, 'damo/cv_resnet101_face-detection_cvpr22papermogface')
src_img_path = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/mog_face_detection.jpg'
raw_result = mog_face_detection_func(src_img_path)
print('face detection output: {}.'.format(raw_result))
# if you want to show the result, you can run
from modelscope.utils.cv.image_utils import draw_face_detection_no_lm_result
from modelscope.preprocessors.image import LoadImage
import cv2
import numpy as np
# load image from url as rgb order
src_img = LoadImage.convert_to_ndarray(src_img_path)
# save src image as bgr order to local
src_img = cv2.cvtColor(np.asarray(src_img), cv2.COLOR_RGB2BGR)
cv2.imwrite('src_img.jpg', src_img)
# draw dst image from local src image as bgr order
dst_img = draw_face_detection_no_lm_result('src_img.jpg', raw_result)
# save dst image as bgr order to local
cv2.imwrite('dst_img.jpg', dst_img)
# show dst image by rgb order
import matplotlib.pyplot as plt
dst_img = cv2.cvtColor(np.asarray(dst_img), cv2.COLOR_BGR2RGB)
plt.imshow(dst_img)
使用方式
- 推理:输入图片,如存在人脸则返回人的性别以及年龄区间。
目标场景
- 人脸相关的基础能力,可应用于视频监控/人像美颜/互动娱乐等场景
模型局限性及可能偏差
- 训练数据仅包括FairFace数据集,模型鲁棒性可能有所欠缺。
- 目前只支持单人的属性识别。
- 当前版本在python 3.7环境测试通过,其他环境下可用性待测试
预处理
测试时主要的预处理如下:
- Resize:图像resize到224x224
- Normalize:图像归一化,减均值除以标准差
来源说明
本模型及代码来自开源社区(地址),请遵守相关许可。
引用
如果你觉得这个该模型对有所帮助,请考虑引用下面的相关的论文:
@article{karkkainen2019fairface,
title={Fairface: Face attribute dataset for balanced race, gender, and age},
author={K{\"a}rkk{\"a}inen, Kimmo and Joo, Jungseock},
journal={arXiv preprint arXiv:1908.04913},
year={2019}
}
评论