日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程语言 > python >内容正文

python

python 菜品识别_菜品识别-python

發(fā)布時(shí)間:2023/12/15 python 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 菜品识别_菜品识别-python 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

直接上代碼,用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')

""" 調(diào)用菜品識(shí)別 """

client.dishDetect(image);

""" 如果有可選參數(shù) """

options = {}

options["top_num"] = 10

options["filter_threshold"] = "0.7"

options["baike_num"] = 1

""" 帶參數(shù)調(diào)用菜品識(shí)別 """

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': '時(shí)令小菜', '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'}

然后取值即可,有什么問題留言即可,

總結(jié)

以上是生活随笔為你收集整理的python 菜品识别_菜品识别-python的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。