人脸识别模型试用
2024-01-05 本文已影响0人
梅西爱骑车
前几天用社保APP给我妈进行人脸识别,总是识别失败,今天实验了一个人脸识别模型,本模型可以检测输入图片中人脸以及对应关键点的位置,实现人脸检测和人脸关键点定位二合一。
web方式体验,可以上传照片,然后输出五官位置,从json输出看某个关键点的值为128.32200622558594,其精度已经很高。
json格式输出信息如下:
{
"detail": "",
"code": 0,
"computation_time": "0.12s",
"data": {
"boxes": [
[
71.2724380493164,
115.34973907470703,
288.6782531738281,
383.5452575683594
]
],
"keypoints": [
[
128.32200622558594,
210.29916381835938,
235.47373962402344,
209.12826538085938,
184.6835174560547,
267.1566467285156,
148.74679565429688,
321.8645324707031,
225.14280700683594,
320.134521484375
]
],
"scores": [
0.9998264908790588
]
},
"id": "045900e1-cf14-4962-923f-ffb39d264718",
"msg": "",
"queue": 0,
"queue_time": 0,
"status": 2
}
python代码调用示例:
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
retina_face_detection = pipeline(Tasks.face_detection, 'damo/cv_resnet50_face-detection_retinaface')
img_path = 'https://guoxiuzhi.com/test/images/retina_face_detection.jpg'
result = retina_face_detection(img_path)
print(f'face detection output: {result}.')