百度人脸识别使用指南-视频活体检测API文档 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
产品推荐: 1、安全稳定的云服务器租用,2核/2G/5M仅37元,点击抢购>>>; 2、高防物理服务器20核/16G/50M/500G防御仅350元,点击抢购>>> 3、百度智能建站(五合一网站)仅880元/年,点击抢购>>> 模板建站(PC+手机站)仅480元/年,点击抢购>>> 4、阿里云服务器2核2G3M仅99元/年、2核4G5M仅199元/年,新老同享,点击抢购>>> 5、腾讯云服务器2核2G4M仅99元/年、新老同享,点击抢购>>> 点击这里申请百度智能云特邀VIP帐号,立即体验人脸识别>>> 百度人脸识别使用指南-视频活体检测API文档 如果您对文档内容有任何疑问,可以通过以下几种方式联系我们:
一、视频活体检测能力介绍业务能力 视频活体检测产品,是由两个接口(视频活体检测+随机校验码)组合而成,可实现动作视频活体、数字视频活体两种活体检测方式。主要应用在H5场景下,通过用户新录制并上传一个视频,来进行活体检测的判断,同时比单张图片活体检测方式更加安全。其主要功能如下所示:
主要适用场景
此方案的优劣势
调用方式请求URL数据格式 向API服务地址使用POST发送请求,必须在URL中带上参数access_token,可通过后台的API Key和Secret Key生成,具体方式请参考“Access Token获取”。 示例代码 #!/bin/bash curl -i -k 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id=【百度云应用的AK】&client_secret=【百度云应用的SK】'
例如此接口,使用HTTPS POST发送: https://aip.baidubce.com/rest/2.0/face/v1/merge?access_token=24.f9ba9c5341b67688ab4added8bc91dec.2592000.1485570332.282335-8574074 POST中Body的参数,按照下方请求参数说明选择即可。
1.1 随机校验码接口(原语音验证码接口)接口描述此接口主要用于生成随机码,用于视频的语音/动作识别校验使用,以判断视频的即时性,而非事先录制的,提升作弊的难度。 在线调试您可以在 示例代码中心 中调试该接口,可进行签名验证、查看在线调用的请求内容和返回结果、示例代码的自动生成。 请求说明请求示例 HTTP方法:POST 请求URL: https://aip.baidubce.com/rest/2.0/face/v1/faceliveness/sessioncode URL参数:
Header:
Body中放置请求参数,参数详情如下:
返回说明返回参数
返回示例 {
"err_no": 0,
"err_msg": "SUCCESS",
"result": {
"session_id": "S59faeeebb9111890355690", //会话ID
"code": "045" //当为视频动作活体时,返回值的代表所需动作和动作顺序。 0:眨眼 4:抬头 5:低头
},
"timestamp": 1509617387,
"cached": 0,
"serverlogid": "0587756642",
"error_code": 0,
"error_message": "SUCCESS"
}
1.2 视频活体检测接口接口描述此接口一方面通过随机验证码接口获取语音/动作校验码,通过session code来判断视频是否作弊。另一方面进行视频抽帧,判断是否为活体。 在线调试您可以在 示例代码中心 中调试该接口,可进行签名验证、查看在线调用的请求内容和返回结果、示例代码的自动生成。 请求说明请求示例 HTTP方法:POST 请求URL: https://aip.baidubce.com/rest/2.0/face/v1/faceliveness/verify URL参数:
Header:
Body中放置请求参数,参数详情如下: 请求参数
请求示例 {
"session_id": "S62b193a44a46c363371046",
"video_base64": "video_base64_value",
"type_identify": "voice",
"lip_identify": "STRICT",
"face_field": "spoofing,quality"
} 返回说明返回参数
返回示例 {
"err_no": 0,
"err_msg": "SUCCESS",
"result": {
"score": 0.18,
"maxspoofing": 0.0002082588035,
"spoofing_score": 0.00018671568975,
"code": {
"create": "853",
"identify": "23456789",
"similarity": 0.13
},
"lip_language": "fail", //lip_identify 为 COMMON 或 STRICT 时返回该字段值,值为pass 或 false
"action_verify": "fail", //type_identify 为 action 时返回该字段值,值为pass 或 false【注意:action_verify与lip_language是互斥的】
"thresholds": {
"frr_1e-4": 0.05, //万分之一误拒率的阈值
"frr_1e-3": 0.3, //千分之一误拒率的阈值
"frr_1e-2": 0.9, //百分之一误拒率的阈值
},
"best_image": {
"pic": "图片base64值",
"face_token": "0839b921224816fb558b0a74ee6284fb",
"face_id": "0839b921224816fb558b0a74ee6284fb",
"liveness_score": 0.9634260269,
"spoofing": 0.0001962436945,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
},
"pic_list": [ //默认返回8张图片
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "f043b6c7d202cb25e8dfc24fccf37553",
"face_id": "f043b6c7d202cb25e8dfc24fccf37553",
"liveness_score": 0.18,
"spoofing": 0.000179775554,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
},
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "d12b7e32069d337dc5d57cd3d15e2935",
"face_id": "d12b7e32069d337dc5d57cd3d15e2935",
"liveness_score": 0.06,
"spoofing": 0.0002082588035,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
},
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "6411f95f491fb665c389de03a33f12a4",
"face_id": "6411f95f491fb665c389de03a33f12a4",
"liveness_score": 0.06,
"spoofing": 0.0001938246714,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
},
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "d7fb09b7942555bf1e4b8d47a63c2e4b",
"face_id": "d7fb09b7942555bf1e4b8d47a63c2e4b",
"liveness_score": 0.05,
"spoofing": 0.0001579090458
},
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "b14f94951a1d1b0fb8770bb1ef2bf2e7",
"face_id": "b14f94951a1d1b0fb8770bb1ef2bf2e7",
"liveness_score": 0.05,
"spoofing": 0.0001889262057,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
},
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "f7f363d0e71e91906dbdcfec0573de70",
"face_id": "f7f363d0e71e91906dbdcfec0573de70",
"liveness_score": 0.05,
"spoofing": 0.0001999060332,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
},
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "388bdccbd70200f62c5f46a84b012691",
"face_id": "388bdccbd70200f62c5f46a84b012691",
"liveness_score": 0.04,
"spoofing": 0.0001798788871,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
},
{
"pic" : "gAQTGF2YzU4LjkyLjEwMAD", //图片base64编码后的值
"face_token": "5fa4e1116f00912f66dba9b42a6a739e",
"face_id": "5fa4e1116f00912f66dba9b42a6a739e",
"liveness_score": 0.04,
"spoofing": 0.0001976373605,
"quality": {
"occlusion": {
"left_eye": 0,
"right_eye": 0,
"nose": 0,
"mouth": 0,
"left_cheek": 0,
"right_cheek": 0,
"chin_contour": 0
},
"blur": 0,
"illumination": 114,
"completeness": 1
},
"angle": {
"yaw": 1.59,
"pitch": 0.26,
"roll": -5.46
}
}
]
},
"timestamp": 1597148814,
"cached": 0,
"serverlogid": 1614796453,
"error_code": 0,
"error_msg": "SUCCESS"
} 活体阈值参考请务必在产品侧做好以下条件限制
关于活体检测faceliveness的判断阈值选择,可参考以下数值信息:
关于以上数值的概念介绍:
合成图阈值参考
关于合成图检测spoofing的判断阈值选择,可参考以下数值信息:
错误码列表
二、实时活体检测方案如您需要使用实时的活体检测方式,即无需用户录制并上传视频,直接在前端实时完成活体检测流程,以提升整体核验流程的流畅度及用户体验。可通过H5实名认证方案进行接入。您可根据您的业务环境选择APP方案接入或H5方案接入。
如果您对文档内容有任何疑问,可以通过以下几种方式联系我们:
|