首页 > 分享 > python 菜品识别

python 菜品识别

最新推荐文章于 2024-10-30 15:22:37 发布

weixin_39687301 于 2021-02-09 13:52:15 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

直接上代码,用python写的

from aip import AipImageClassify

""" 你的 APPID AK SK """

APP_ID = '自己id'

API_KEY = '自己ak'

SECRET_KEY = '自己sk'

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('1.jpg')

""" 调用菜品识别 """

client.dishDetect(image);

""" 如果有可选参数 """

options = {}

options["top_num"] = 10

options["filter_threshold"] = "0.7"

options["baike_num"] = 1

""" 带参数调用菜品识别 """

res = client.dishDetect(image, options)

#print (res)

for k in res:

print ("%s->%s"%(k,res[k]))

#for value in res.values():

# print(value)

输出的值在下面↓

log_id->2672950373429050871

result_num->10

result->[{'calorie': '8', 'has_calorie': True, 'baike_info': {}, 'probability': '0.13639', 'name': '油麦菜'}, {'calorie': '16', 'has_calorie': True, 'name': '黄瓜', 'probability': '0.125964'}, {'calorie': '41', 'has_calorie': True, 'name': '炒青菜', 'probability': '0.0669439'}, {'calorie': '22', 'has_calorie': True, 'name': '芥兰', 'probability': '0.0554446'}, {'calorie': '13', 'has_calorie': True, 'name': '时令小菜', 'probability': '0.0486102'}, {'calorie': '32', 'has_calorie': True, 'name': '开胃小菜', 'probability': '0.0421106'}, {'calorie': '35', 'has_calorie': True, 'name': '白灼菜心', 'probability': '0.0379339'}, {'has_calorie': False, 'name': '素凉菜', 'probability': '0.0372788'}, {'calorie': '45', 'has_calorie': True, 'name': '秋葵', 'probability': '0.0285839'}, {'calorie': '41', 'has_calorie': True, 'name': '烧青菜', 'probability': '0.0215327'}

然后取值即可,有什么问题留言即可,

相关知识

python 手写字识别
基于python编程的五种鲜花识别
0020期python训练鲜花识别
20行Python代码开发植物识别 app
花卉识别python
深度学习花卉识别:Python数据集解析
Python 识别花卉种类,并自动整理分类
Python花店花品信息管理系统
Python实现识别花卉种类的示例代码
如何快速使用Python神经网络识别手写字符?(文末福利)

网址: python 菜品识别 https://m.huajiangbk.com/newsview1144194.html

所属分类:花卉
上一篇: 不同LED光质对生菜生长和营养品
下一篇: 2023年4月19日北京市豆角批