Mushoom ID는 머신러닝 이미지 인식을 기반으로 한 버섯 식별 API입니다. API 키를 받고 구현을 시작하세요.
곰팡이 이미지를 보내주시면 추가 정보와 함께 가능한 종 제안 목록을 받아보실 수 있습니다.
pip install kindwise-api-client
from kindwise import MushroomApi
api = MushroomApi ( 'your_api_key' )
identification = api . identify ( '../images/unknown_mushroom.jpg' , details = [ 'url' , 'common_names' ])
for suggestion in identification . result . classification . suggestions :
print ( suggestion . name )
print ( f'probability { suggestion . probability :.2% } ' )
print ( suggestion . details [ 'url' ])
print ( suggestion . details [ 'common_names' ])
print ()
순수 파이썬의 동일한 예
import base64
import requests
# encode images to base64
with open ( 'unknown_mushroom.jpg' , 'rb' ) as file :
images = [ base64 . b64encode ( file . read ()). decode ( 'ascii' )]
response = requests . post (
'https://mushroom.kindwise.com/api/v1/identification?details=common_names,url' ,
json = {
'images' : images ,
'similar_images' : True ,
},
headers = {
'Content-Type' : 'application/json' ,
'Api-Key' : '-- ask for one: https://admin.kindwise.com/signup --' ,
}). json ()
for suggestion in response [ 'result' ][ 'classification' ][ 'suggestions' ]:
print ( suggestion [ 'name' ]) # Lactarius deterrimus
print ( suggestion [ 'details' ][ 'common_names' ]) # orange milkcap
print ( suggestion [ 'details' ][ 'url' ]) # https://en.wikipedia.org/wiki/Lactarius_deterrimus