百度在线人脸识别技术性能测试
1,百度在线人脸识别技术文档
https://cloud.baidu.com/doc/FACE/Face-Search.html#.E8.AF.B7.E6.B1.82.E8.AF.B4.E6.98.8E
2,测试目的
注册1万张人脸库,然后输入图片进行匹配检测,测试其从人脸库识别目标的准确性和速度。
3,测试代码
参考下文进行测试。对人脸注册部分的代码进行了修改,以批量方式注册人脸。
https://blog.csdn.net/midaszhk/article/details/77340219
4,测试环境
² PC机:windows7 64位旗舰版 SP1,4GB内存;AMD A6-7400K
² Python 3.5 64位
5,测试步骤
5.1 注册人脸库
运行程序:face2.py –add2
共注册人脸10872张。人员ID共2287个。
注:受限于人脸图片采集较为耗时,因此相同ID下的人脸图片采用相同的图片,不同ID下的图片也存在相同的人脸。注册人脸参见:附录1:人脸库注册照片集
5.2 人脸识别测试1
在人脸库中注册数量达到5586个时,测试人脸(参见附录2:测试照片集)识别的结果如下表,可见:
1,在控制输入图片尺寸不要过大时,api识别反馈时间小于1秒
2,以匹配分数80为界,在库人员和非在库人员识别结果正确。
测试类别 |
输入 |
图片尺寸 |
输出 |
最高匹配得分 |
识别是否正确 |
耗时(秒) |
在库人员1 |
Jack1.jpg |
4224*5632 |
jack-kwok1.jpg |
94 |
1 |
2 |
Jack2.jpg |
4224*5632 |
jack-kwok1.jpg |
94 |
1 |
2 |
|
Jack3.jpg |
4224*5632 |
jack-kwok2,jpg |
93 |
1 |
3 |
|
Jack1.jpg |
500*667 |
jack-kwok1.jpg |
95 |
1 |
0 |
|
Jack2.jpg |
500*667 |
jack-kwok1.jpg |
95 |
1 |
0 |
|
Jack3.jpg |
500*667 |
jack-kwok2,jpg |
94 |
1 |
0 |
|
在库人员2 |
JackMa.jpg |
500*434 |
mayun1.jpg |
91 |
1 |
0 |
JackMa2.jpg |
733*574 |
mayun1.jpg |
94 |
1 |
0 |
|
不在库人员1 |
Noreg1.jpg |
1730*1597 |
- |
20 |
1 |
0 |
不在库人员2 |
Noreg2.jpg |
634*407 |
- |
54 |
1 |
0 |
5.2.1在库人员1
5.2.1.1输入大图4224*5632
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ck1.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"10","scores":[94.944915771484],"group_id":"face1000","user_in
fo":"jack-kwok1.jpg info to be added."},{"uid":"10","scores":[94.944915771484],"
group_id":"face1000","user_info":"jack-kwok1.jpg info to be added."}],"result_nu
m":2,"log_id":2750418294071813}
0: 10 scores: 94 group: face1000
1: 10 scores: 94 group: face1000
2
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ck2.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"10","scores":[94.432579040527],"group_id":"face1000","user_in
fo":"jack-kwok1.jpg info to be added."},{"uid":"10","scores":[94.432579040527],"
group_id":"face1000","user_info":"jack-kwok1.jpg info to be added."}],"result_nu
m":2,"log_id":2759043572071813}
0: 10 scores: 94 group: face1000
1: 10 scores: 94 group: face1000
2
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ck3.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"11","scores":[93.317947387695],"group_id":"face1000","user_in
fo":"jack-kwok2.jpg info to be added."},{"uid":"11","scores":[93.317947387695],"
group_id":"face1000","user_info":"jack-kwok2.jpg info to be added."}],"result_nu
m":2,"log_id":2751478195071813}
0: 11 scores: 93 group: face1000
1: 11 scores: 93 group: face1000
3
5.2.1.2输入小图500*667
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ck1.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"10","scores":[95.532615661621],"group_id":"face1000","user_in
fo":"jack-kwok1.jpg info to be added."},{"uid":"10","scores":[95.532615661621],"
group_id":"face1000","user_info":"jack-kwok1.jpg info to be added."}],"result_nu
m":2,"log_id":2889208623071813}
0: 10 scores: 95 group: face1000
1: 10 scores: 95 group: face1000
0
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ck2.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"10","scores":[95.283851623535],"group_id":"face1000","user_in
fo":"jack-kwok1.jpg info to be added."},{"uid":"10","scores":[95.283851623535],"
group_id":"face1000","user_info":"jack-kwok1.jpg info to be added."}],"result_nu
m":2,"log_id":2890058562071813}
0: 10 scores: 95 group: face1000
1: 10 scores: 95 group: face1000
0
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ck3.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"11","scores":[94.254653930664],"group_id":"face1000","user_in
fo":"jack-kwok2.jpg info to be added."},{"uid":"11","scores":[94.254653930664],"
group_id":"face1000","user_info":"jack-kwok2.jpg info to be added."}],"result_nu
m":2,"log_id":2890630033071813}
0: 11 scores: 94 group: face1000
1: 11 scores: 94 group: face1000
0
5.2.2在库人员2
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ckma2.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"18","scores":[94.516395568848],"group_id":"face1000","user_in
fo":"mayun1.jpg info to be added."},{"uid":"18","scores":[94.516395568848],"grou
p_id":"face1000","user_info":"mayun1.jpg info to be added."}],"result_num":2,"lo
g_id":2797092861071813}
0: 18 scores: 94 group: face1000
1: 18 scores: 94 group: face1000
0
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id ja
ckma.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"18","scores":[91.986534118652],"group_id":"face1000","user_in
fo":"mayun1.jpg info to be added."},{"uid":"18","scores":[91.986534118652],"grou
p_id":"face1000","user_info":"mayun1.jpg info to be added."}],"result_num":2,"lo
g_id":2799813774071813}
0: 18 scores: 91 group: face1000
1: 18 scores: 91 group: face1000
0
5.2.3不在库人员1
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id no
reg1.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"18","scores":[20.506534576416],"group_id":"face1000","user_in
fo":"mayun1.jpg info to be added."},{"uid":"18","scores":[20.506534576416],"grou
p_id":"face1000","user_info":"mayun1.jpg info to be added."}],"result_num":2,"lo
g_id":2852407994071813}
0: 18 scores: 20 group: face1000
1: 18 scores: 20 group: face1000
0
5.2.4不在库人员2
F:\XXX\工作\201806\人脸识别应用研究\百度人脸识别\人脸识别SDKv3>face.py -id no
reg2.jpg
//------ start read image data ...
//------ start urlencode data ...
//------ start request() ...
//------ start urlopen() ...It may take a while....
{"result":[{"uid":"13","scores":[54.975402832031],"group_id":"face1000","user_in
fo":"jetLi_2ren.jpg info to be added."},{"uid":"13","scores":[54.975402832031],"
group_id":"face1000","user_info":"jetLi_2ren.jpg info to be added."}],"result_nu
m":2,"log_id":2861838227071813}
0: 13 scores: 54 group: face1000
1: 13 scores: 54 group: face1000
0
5.3 人脸识别测试2
在人脸库中注册数量达到10872个时,测试人脸(参见附录2:测试照片集)识别的结果如下表,可见与5.2 人脸识别测试1 结果完全相同:
1,在控制输入图片尺寸不要过大时,api识别反馈时间小于1秒
2,以匹配分数80为界,在库人员和非在库人员识别结果正确。
测试类别 |
输入 |
图片尺寸 |
输出 |
最高匹配得分 |
识别是否正确 |
耗时(秒) |
在库人员1 |
Jack1.jpg |
500*667 |
jack-kwok1.jpg |
95 |
1 |
0 |
Jack2.jpg |
500*667 |
jack-kwok1.jpg |
95 |
1 |
0 |
|
Jack3.jpg |
500*667 |
jack-kwok2,jpg |
94 |
1 |
0 |
|
在库人员2 |
JackMa.jpg |
500*434 |
mayun1.jpg |
91 |
1 |
0 |
JackMa2.jpg |
733*574 |
mayun1.jpg |
94 |
1 |
0 |
|
在库人员3 |
Ldh_test1.jpg |
|
Ldh_2ren.jpg |
85 |
1 |
0 |
Ldh_test2.jpg |
|
Ldh_2ren.jpg |
94 |
1 |
0 |
|
不在库人员1 |
Noreg1.jpg |
1730*1597 |
- |
20 |
1 |
0 |
不在库人员2 |
Noreg2.jpg |
634*407 |
- |
54 |
1 |
0 |
不在库人员3 |
Noreg3.jpg |
|
|
22 |
1 |
0 |
6,测试结论
经实测,总结百度在线人脸识别功能具有准确、快速、方便、免费等4大特点,具体如下:
优势:
² 识别准确。一般在库人员匹配值>80,而非在库人员匹配值远小于80。
² 识别快速。1万注册人脸下的识别时间小于1秒。
² 支持人脸库采用API管理,方便使用。
² 人脸识别下基础在线API接口调用量免费,无需支付费用即可无限制调用。
劣势:
² QPS限制。QPS(query per second)指每秒向服务发送的请求数量峰值,相当于每个API每秒可以允许请求的最大上限数量。免费QPS默认为2,如果您通过百度云的企业认证,基础在线API接口的免费QPS将扩充至10。QPS可按天按月灵活购买:300元 / 月 / QPS 或 30元 / 天 / QPS
² 应用开发无自主核心技术,完全依赖百度云服务,现场需顺畅连接互联网。
注意事项:
² 本次测试对于识别准确性的测试并不完整,实际使用中有诸多因素可能降低识别率。如帽子、眼镜等的遮挡,光线过亮或过暗的影响,人员侧脸、低头、化妆等多种因素。
² 如果不想受QPS和在线使用的限制,百度也提供了人脸离线识别SDK,以及SDK+API离在线混用模式。但人脸离线识别SDK需按每设备299元付费。详见:http://ai.baidu.com/tech/face/offline-sdk
附录1:人脸库注册照片集
附录2:测试照片集