Skip to content

Running inference on images to detect the species of animals and plants with the Microsoft AI for Earth Species Recognition Model

License

Notifications You must be signed in to change notification settings

EibSReM/MicrosoftSpeciesClassification

Repository files navigation

MicrosoftSpeciesClassification

Script to classify images of plants and animals with the image-based species recognition models provided by Microsoft AI for Earth. The code was extracted from this Microsoft repository, which can also be used for the inference on its own by following the described steps there, but it contains some more scripts which were not necessary for us and thus removed in this repository. The model is not updated anymore.

How-To

  1. Install conda / miniconda if you do not have already (see here for installation of miniconda and here for a conda cheatsheet).

  2. Create a conda environment from the environment.yml file by executing

conda env create -f environment.yml
  1. Clone this repository by
git clone https://github.com/EibSReM/MicrosoftSpeciesClassification.git

and change to respective directory (cd MicrosoftSpeciesClassification)

  1. If you want to download the pretrained pytorch model manually you can do so here (409 MB). This is not mandatory since the script also offers the opportunity to download the model automatically.

  2. The same for the taxononmy file that you can download manually here

  3. Adapt api_root in the classify_images.py script. It should be the path to the cloned repository.

  4. Adapt the paths to the pytorch model, the taxonomy file and the images (folder) in the classify_images.py script (if you don't want to download the model and taxonomy files beforehand the script can do it for you, if you change the paths to the given hyperlinks)

  5. Run script

python classify_images.py
  1. Find results in classification_output.csv

Runtime

Classifying 204 images, the script run 2175 seconds (~ 36 minutes) on a Windows 10 notebook with the following hardware specifications:

  • Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz 1.99 GHz
  • 20 GB Ram

Approach Demo

In the folder demo you can find a couple of images and a README with the expected results for demonstration purposes.

About

Running inference on images to detect the species of animals and plants with the Microsoft AI for Earth Species Recognition Model

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published