Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Plant Disease Classification with TensorFlow Li...

Plant Disease Classification with TensorFlow Lite on Android

At DevFest 2019 Yaounde , we created an end-to-end Android application with TFLite. We opted to develop an Android application that detects plant diseases.
Agenda :
1- Machine Learning overview
2- Building Deep Learning Model using TensorFlow and Keras
3- Deploying the Model to an Android App using TFLite

Yannick Serge Obam

October 12, 2019
Tweet

More Decks by Yannick Serge Obam

Other Decks in Technology

Transcript

  1. - Software engineer & Co-Founder at isoMora - AI/ML Evangelist

    | Cloud Mentor | Teacher - Co-Organiser GDG Ebolowa Yannick Serge Obam @OBAMSerge
  2. Agenda 1- Machine Learning overview 2- Building Deep Learning Model

    using TensorFlow and Keras 3- Deploying the Model to an Android App using TFLite
  3. ML concepts Artificial Intellgence Machine Learning Deep Learning AI: The

    broad discipline of creating intelligent machines. ML: A system that can learn from experience. DL: A system that learn from experience on large data sets using deep neural networks.
  4. Type of ML Supervised Learning • Data -> input •

    Label -> targets • Iteration of training, algorithm finds desired output • Regression and Classification problems Unsupervised Learning: • No labels • Not structured data • Clustering problems Reinforcement Learning: • Reward-based learning • learn from its experience
  5. What’s a Neural Network? NN: a stack of layers. Layer:

    is made up of units . Unit: also called neurons, like the nerve cells in the biological brain. Dense Layer: stack of layers are fully connected Weight & Biases: internal variables of model which are updated during training Model: the representation of neural network
  6. Step 1: Get Data Step 2: Preprocess the data Step

    3: Choose an Algorithm Step 4: Train the model Step 5 : Run/Deploy the model
  7. TensorFlow An open source Deep Learning library • >1,800 contributors

    worldwide • Built with C++ • Powers nearly every single ML project @ Google • Latest Release: 2.0 as of today TensorFlow 2.0 • Easier to learn and use • For beginners and experts
  8. Problem Statement The diagnosis of pests and diseases is essential

    for agricultural production. This lab invited participants to design algorithms and models to recognise species and diseases in the crop leaves
  9. Images dataset 54 306- images of plant leaf for PlantVillage

    Dataset With 38 classes of combination Plant -> Diseases
  10. # convert the model to TFLite !mkdir ”tflite_models” TFLITE_MODEL =

    ”tflite_models/plant_disease_model.tflite” # Get the concrete function from the Keras model. run_model = tf.function(lambda x : reloaded(x)) # Save the concrete function. concrete_func = run_model.get_concrete_function( tf.TensorSpec(model.inputs[0].shape, model.inputs[0].dtype) Convert Model to TFLite
  11. # Convert the model to standard TensorFlow Lite converter =

    tf.lite.TFLiteConverter.from_concrete_functions([concrete_func]) converted_tflite_model = converter.convert() open(TFLITE_MODEL, ”wp”).write(converted_tflite_model) Convert Model to TFLite
  12. 1- Open Android Studio. 2- Click Import project (Gradle, Eclipse

    ADT, etc.). 3- Choose the GreenDoctor/start/ folder from where you extracted the archive to. 4- Wait for the import processes to finish Import the app to Android Studio
  13. Add TensorFlow Lite to the Android app Copy the TensorFlow

    Lite model plant_disease_model.tflite and plant_labels.txt into assets/ directory
  14. Resources Blogs: Plant Disease Classification with TensorFlow Lite on Android

    Part 1 Plant Disease Classification with TensorFlow Lite on Android Part 2 Colab : http://bit.ly/plant-disease-model Source code Video: App demo Official Tensorflow site: https://www.tensorflow.org