首页 > 分享 > python图像识别植物识别

python图像识别植物识别

错误代码:{'error_code': 110, 'error_msg': 'Access token invalid or no longer valid'}

有Access token生成,但是后面一直是错误。。。。

code:

# encoding:utf-8

import requests

import base64

'''

植物识别

'''

# client_id 为官网获取的AK, client_secret 为官网获取的SK

host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&client_id={API Key}={Secret Key}'

response = requests.get(host)

mytoken = response.json()

print(mytoken)

request_url = "https://aip.baidubce.com/rest/2.0/image-classify/v1/plant"

# 二进制方式打开图片文件

f = open("", "rb")

img = base64.b64encode(f.read())

params = {"image":img}

access_token = "mytoken"

request_url = request_url + "?access_token=" + access_token

headers = {'content-type': 'application/x-www-form-urlencoded'}

response = requests.post(request_url, data=params, headers=headers)

if response:

print (response.json())

相关知识

Python实现识别花卉种类的示例代码
Python识别花卉种类,并自动整理分类!
Python 识别花卉种类,并自动整理分类!
深度学习花卉识别:Python数据集解析
植物识别接口 花卉识别 植物花卉识别 图像识别
基于python编程的五种鲜花识别
20行Python代码开发植物识别 app
图像识别算法有哪些
【花卉识别系统】Python+卷积神经网络算法+人工智能+深度学习+图像识别+算法模型
0020期python训练鲜花识别

网址: python图像识别植物识别 https://m.huajiangbk.com/newsview411577.html

所属分类:花卉
上一篇: 原生仙客来品种
下一篇: 仙客来有几种颜色