是这样的我在利用百度api做一个人脸比对
源代码如下
from aip import AipFace
""" 你的 APPID AK SK """
APP_ID = '18814618'
API_KEY = 'A1bFwZeTGWRlg5MDk4ycu24q'
SECRET_KEY = '186VKOrpAe0Lo1TtzPiTX5NjnExY7KCS'
client = AipFace(APP_ID, API_KEY, SECRET_KEY)
""" 读取图片 """
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
images = [
get_file_content('D://001.jpg'),
get_file_content('D://002.jpg'),
]
""" 调用人脸比对 """
client.match(images);
""" 如果有可选参数 """
options = {}
options["ext_fields"] = "qualities"
options["image_liveness"] = ",faceliveness"
options["types"] = "7,13"
""" 带参数调用人脸比对 """
result = client.match(images, options)
print (result)
错误提示
Object of type bytes is not JSON serializable