Code Monkey home page Code Monkey logo

plantify-image-recognition's Introduction

Plant Image Recognition for Plantify

Model for plant recognition in Plantify project with pre-built model provided by Google Tensorflow

View in TensorFlow Hub website

Overview

This model is trained to recognize 2101 plants species from images. It is based on MobileNet, and trained on photos contributed by the iNaturalist community.

The species and images are a subset of the iNaturalist 2017 Competition dataset, organized by Visipedia. This model was originally published as part of the Natural Explorer module for Google's AIY Vision Kit.

Input

This model takes input of images. Inputs are expected to be 3-channel RGB color images of size 224 x 224, scaled to [0, 1].

Output

This model outputs to image_classifier.

image_classifier: A probability vector of dimension 2102, corresponding to a background class and 2101 plant species in the labelmap. See labels.txt for the list of plant species.

Mechanism

  • It imports the necessary libraries: tensorflow, tensorflow_hub as hub, numpy as np, and PIL.Image as Image
  • It loads the pre-trained plant classification model from TensorFlow Hub using the hub.KerasLayer() function. The model used in this example is the "plants_V1" model from the AIY Vision Kit
  • It defines the path to the input image and opens it using the PIL.Image.open() function. The image is then resized to (224, 224) pixels
  • The pixel values of the image are normalized between 0 and 1 by dividing the image array by 255.0
  • The image array is expanded to include a batch dimension by adding an extra dimension using np.newaxis
  • The pre-trained model is used to make predictions on the input image by passing the image array to the model object.
  • The predicted class index is obtained by finding the index with the highest predicted probability using np.argmax(predictions, axis=1)[0]
  • The code then loads a class labels mapping from a file. Each line in the file represents a class label, and the index and name are separated by a comma. The class labels are stored in a dictionary with the index as the key and the name as the value
  • The predicted class index is used to retrieve the corresponding plant name from the class labels' dictionary
  • Finally, the predicted plant name is printed

THIS MODEL CANNOT BE RE-TRAINED

plantify-image-recognition's People

Contributors

tinykishore avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.