人脸识别模型TransFace。
人脸识别模型TransFace,训练数据使用了Glint360数据。
本模型可以检测输入图片中人脸的特征。
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
from modelscope.outputs import OutputKeys
import numpy as np
face_mask_recognition_func = pipeline(Tasks.face_recognition, 'damo/cv_vit_face-recognition')
img1 = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_1.png'
img2 = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/face_recognition_2.png'
emb1 = face_mask_recognition_func(img1)[OutputKeys.IMG_EMBEDDING]
emb2 = face_mask_recognition_func(img2)[OutputKeys.IMG_EMBEDDING]
sim = np.dot(emb1[0], emb2[0])
print(f'Face cosine similarity={sim:.3f}, img1:{img1} img2:{img2}')
Method | IJBC(1e-5) | IJBC(1e-4) | IJBC(1e-3) |
---|---|---|---|
TransFace | 96.18 | 97.45 | 98.17 |
本模型及代码来自达摩院自研技术。