Skip to content

flowerchecker/insect-id-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Insect-id-API

Insect.id offers insect identification API based on machine learning. Obtain the API key and get started with your implementation.

Insect Identification 🐞

Send us your insect images, and get a list of possible species suggestions with additional information.

pip install kindwise-api-client
from kindwise import InsectApi

api = InsectApi('your_api_key')
identification = api.identify('../images/unknown_insect.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()

Same example in pure python

import base64
import requests

# encode images to base64
with open('unknown_insect.jpg', 'rb') as file:
    images = [base64.b64encode(file.read()).decode('ascii')]

response = requests.post(
    'https://insect.kindwise.com/api/v1/identification',
    params={'details': 'url,common_names'},
    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'])                     # Lucanus cervus
    print(suggestion['details']['common_names'])  # European Stag Beetle
    print(suggestion['details']['url'])           # https://en.wikipedia.org/wiki/Lucanus_cervus

About

Documentation for beta version of Insect.id API.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages