代码如下:
import base64
from aip import AipFace
APP_ID='APP_ID'
APP_KEY='APP_KEY'
SECRET_KEY='SECRET_KEY'
client=AipFace(APP_ID,APP_KEY,SECRET_KEY)
result = client.match([
{
'image': base64.b64encode(open('对比图片1.jpg', 'rb').read()),
'image_type': 'BASE64',
},
{
'image': base64.b64encode(open('对比图片2.jpg', 'rb').read()),
'image_type': 'BASE64',
}
])
print(result)
报错信息如下:
Traceback (most recent call last):
File "H:/python/人脸识别/人脸对比-练习.py", line 35, in
'image_type': 'BASE64',
File "H:\python\venv\lib\site-packages\aip\face.py", line 299, in match
return self._request(self.__matchUrl, json.dumps(images, ensure_ascii=False), {
File "D:\Program Files\Python\Python35-32\lib\json\__init__.py", line 237, in dumps
**kw).encode(obj)
File "D:\Program Files\Python\Python35-32\lib\json\encoder.py", line 198, in encode
chunks = self.iterencode(o, _one_shot=True)
File "D:\Program Files\Python\Python35-32\lib\json\encoder.py", line 256, in iterencode
return _iterencode(o, 0)
File "D:\Program Files\Python\Python35-32\lib\json\encoder.py", line 179, in default
raise TypeError(repr(o) + " is not JSON serializable")
有谁知道要怎么解决??