大家好我是kk
这是我的第二篇帖子,这次教大家弄通用物体识别
系统:win10
python3.7
这是代码,评论区有返回结果
from aip import AipImageClassify
""" 你的 APPID AK SK """
APP_ID = '16247256'
API_KEY = 'FMK6KVq9ds6c94k2YDFrL1ju'
SECRET_KEY = 'rec10N3YjVQCzDfseD1ARQTpG6cOmobc '
client = AipImageClassify(APP_ID, API_KEY, SECRET_KEY)
""" 读取图片 """
def get_file_content(filePath):
with open(filePath, 'rb') as fp:
return fp.read()
image = get_file_content('马云.jpg')
""" 调用通用物体识别 """
client.advancedGeneral(image);
""" 如果有可选参数 """
options = {}
#options["baike_num"] = 5
""" 带参数调用通用物体识别 """
request = client.advancedGeneral(image, options)
#print (request)
#print (request['result'])
for k in request:
print ("%s->%s"%(k,request[k]))