python2.7 API-V3 222203
heqikvu14615 发布于2018-08 浏览:1105 回复:0
0
收藏

{"error_code":222203,"error_msg":"image check fail","log_id":1594891510175,"timestamp":1533702816,"cached":0,"result":null}

下面是python代码。怀疑是图片编码的导致的,求答案,感谢。

with open("/home/pi/face_detect_baidu/menjin/qt_inside/qtinside_img.jpg","rb") as f:
base64_data = base64.b64encode(f.read())

'''
人脸搜索
'''

request_url = "https://aip.baidubce.com/rest/2.0/face/v3/search"


params = "{\"image\":\"base64_data\",\"image_type\":\"BASE64\",\"group_id_list\":\"99_meijiang,88_hr,102_cwb,103_tfb,104_yfb,105_yyb,106_zcb,107_gcb\",\"quality_control\":\"LOW\",\"liveness_control\":\"NORMAL\"}"
access_token = content[17:87]
request_url = request_url + "?access_token=" + access_token
request = urllib2.Request(url=request_url, data=params)
request.add_header('Content-Type', 'application/json')
response = urllib2.urlopen(request)
content = response.read()
if content:
print content

收藏
点赞
0
个赞
TOP
切换版块