1.4.1 SDK 人脸检测

优质
小牛编辑
133浏览
2023-12-01

调用人脸检测接口,返回人脸检测的结果
requestsyntax

image = Image(uri="fds://cnbj2.fds.api.xiaomi.com/vision-test/test_img.jpg")
detect_faces_request = DetectFacesRequest(image)
faces_list = vision_client.analysis_faces(detect_faces_request)

parameters

detect_faces_request: DetectFacesRequest对象, 必须

用户在调用人脸检测接口时, 必需提供必要的信息和数据,见
DetectFacesRequest

responsesyntax

    {"faceInfo": [{
                        "facePos": {
                            "faceX": 58,
                            "faceY": 89,
                            "faceH": 92,
                            "faceW": 11,
                            "eyeLeftX": 54,
                            "eyeLeftY": 33,
                            "eyeRightX": 52,
                            "eyeRightY": 56,
                            "noseX": 29,
                            "noseY": 37,
                            "mouthLeftX": 65,
                            "mouthLeftY": 78,
                            "mouthRightX": 23,
                            "mouthRightY": 77
                        },
                        "ageInfo": {
                            "age": 18,
                            "confidence": 0.2956333
                        },
                        "genderInfo": {
                            "gender": "Male",
                            "confidence": "0.8856695"
                        }
                  }]
    }

facePos

faceX,faceY,faceH,faceW,eyeLeftX,eyeLeftY,eyeRightX,eyeRightY,noseX,noseY,mouthLeftX,mouthLeftY,mouthRightX,mouthRightY 均为int

faceX,Y,H,W表示检测到的人脸矩形区域;eyeLeftX,eyeLeftY,eyeRightX,eyeRightY表示检测到的两眼位置坐标信息;noseX,noseY表示检测到的鼻子坐标信息;mouthLeftX,mouthLeftY,mouthRightX,mouthRightY表示检检测到的嘴部位置信息

ageInfo

age int 

人脸识别的年龄。
confidence int 

相应这个年龄的置信度

genderInfo

gender String 

识别出的人脸的性别
confidence int 

相应这个性别的置信度