人脸属性模型FairFace
MogFace为当前SOTA的人脸检测方法,已在Wider Face六项榜单上霸榜一年以上,后续被CVPR2022录取(论文地址,代码地址),该方法的主要贡献是从下面三个角度提升人脸检测器:
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)
测试时主要的预处理如下:
本模型及代码来自开源社区(地址),请遵守相关许可。
如果你觉得这个该模型对有所帮助,请考虑引用下面的相关的论文:
@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}
}