人工智能 2. 图像识别
生活随笔
收集整理的這篇文章主要介紹了
人工智能 2. 图像识别
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
目錄
- 一.動物識別
- 二.植物識別
- ?三.通用物體識別
- ?四.其他
一.動物識別
1.基本格式
from aip import AipImageClassifyimport os """ 你的 APPID AK SK """ APP_ID = '16035518'API_KEY = 'Fx1UnQOItgFpBi9VnYHZHxY8' SECRET_KEY = '39YjAUW6GjdEGFMhIz6rQxdTamVUZLzw'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('dw.jpg')""" 調用動物識別 """ client.animalDetect(image);""" 如果有可選參數 """ options = {} options["top_num"] = 3 options["baike_num"] = 5""" 帶參數調用動物識別 """ res = client.animalDetect(image, options)print(res)2.參數
?
?
二.植物識別
1.基本格式
from aip import AipImageClassifyimport os """ 你的 APPID AK SK """ APP_ID = '16035518'API_KEY = 'Fx1UnQOItgFpBi9VnYHZHxY8' SECRET_KEY = '39YjAUW6GjdEGFMhIz6rQxdTamVUZLzw'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('example.jpg')""" 調用植物識別 """ client.plantDetect(image);""" 如果有可選參數 """ options = {} options["baike_num"] = 5""" 帶參數調用植物識別 """ client.plantDetect(image, options)from aip import AipImageClassifyimport os """ 你的 APPID AK SK """ APP_ID = '16035518'API_KEY = 'Fx1UnQOItgFpBi9VnYHZHxY8' SECRET_KEY = '39YjAUW6GjdEGFMhIz6rQxdTamVUZLzw'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('example.jpg')""" 調用植物識別 """ client.plantDetect(image);""" 如果有可選參數 """ options = {} options["baike_num"] = 5""" 帶參數調用植物識別 """ client.plantDetect(image, options)2.參數
?
?
?三.通用物體識別
1.基本結構
""" 讀取圖片 """ def get_file_content(filePath):with open(filePath, 'rb') as fp:return fp.read()image = get_file_content('example.jpg')""" 調用通用物體識別 """ client.advancedGeneral(image);""" 如果有可選參數 """ options = {} options["baike_num"] = 5""" 帶參數調用通用物體識別 """ client.advancedGeneral(image, options)2.參數
?
? 3.返回信息
{"log_id": 327863200205075661,"result_num": 5,"result": [{"score": 0.967622,"root": "公眾人物","baike_info": {"baike_url": "http://baike.baidu.com/item/%E6%96%B0%E5%9E%A3%E7%BB%93%E8%A1%A3/8035884","image_url": "http://imgsrc.baidu.com/baike/pic/item/91ef76c6a7efce1b27893518a451f3deb58f6546.jpg","description": "新垣結衣(Aragaki Yui),1988年6月11日出生于沖繩縣那霸市。日本女演員、歌手、模特。畢業于日出高中。2001年,參加《nicola》模特比賽并獲得最優秀獎。2005年,因出演現代劇《澀谷15》而作為演員出道。2006年,參演校園劇《我的老大,我的英雄》;同年,她還出版了個人首本寫真集《水漾青春》。2007年,她從日出高校畢業后開始專注于演藝發展,并發表個人首張音樂專輯《天空》;同年,新垣結衣還主演了愛情片《戀空》,而她也憑借該片獲得了多個電影新人獎項。2010年,主演愛情片《花水木》。2011年,主演都市劇《全開女孩》。2012年,相繼參演現代劇《Legal High》、劇情片《劇場版新參者:麒麟之翼》。2013年,主演都市劇《飛翔情報室》。2014年,她主演了劇情片《黎明的沙耶》。2016年,主演愛情喜劇《逃避雖可恥但有用》,并憑借該劇獲得了多個電視劇女主角獎項。2017年,主演愛情片《戀愛回旋》,憑借該片獲得第60屆藍絲帶獎最佳女主角;同年11月,她還憑借醫療劇《Code Blue 3》獲得第94屆日劇學院賞最佳女配角。"},"keyword": "新垣結衣"},{"score": 0.716067,"root": "人物-人物特寫","keyword": "頭發"},{"score": 0.421281,"root": "商品-穿戴","keyword": "圍巾"},{"score": 0.22347,"root": "商品-五金","keyword": "拉鏈"},{"score": 0.028031,"root": "商品-穿戴","keyword": "脖套"}] }?
轉載于:https://www.cnblogs.com/lw1095950124/p/10986683.html
總結
以上是生活随笔為你收集整理的人工智能 2. 图像识别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Web-Security-Learnin
- 下一篇: 快速傅里叶变换(FFT)c语言实现