Sie sind auf Seite 1von 15

PLANT CLASSIFICATION USING DEEP

LEARNING

June 27, 2019

Soma Ram Ganesh


Dandu Sandeep
Vedati Shravan
Contents

0.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
0.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
0.3 Explanation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
0.4 Code Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
0.5 Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
0.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14

1
2

0.1 Introduction

Now we are going to train a Deep Learning model to predict a Plant and classify
among the 12 plant species respectively Black-grass, Charlock, Cleavers, Common
Chickweed, Common wheat, Fat Hen, Loose-Silky-bent, Maize, Scentless Mayweed,
Shepherds Purse, Small-flowered Cranesbill, Sugar beet.
Finally we are going to build a User Interface which can be used by a Layman to
use it for prediction.
The dataset have been recorded at Aarhus University Flakkebjerg Research station
in collaboration between University of Southern Denmark and Aarhus University.

0.2 Requirements
1. Python 3.6

2. Pycharm IDE

3. Flask Framework

4. Python packages respectively Numpy, Pandas, Keras, OpenCV, Tensorflow

0.3 Explanation

This has mainly 2 parts:

Part 1:
We are going to sort all the dataset into two files.
One file contains all the images belonging to the 12 Plant Species.
Another file contains all the labels (plant names) belonging to the images in previ-
ous file.
Then we are going to create a Deep Learning Architecture and Initialize a ADAM
optimizer.
Then we use ImageDataGenerator for Data Augmentation and initializing the train-
ing.
Then training continues till 100 Epochs.
Finally we are going to plot a Classification report on the Trained model and see
3

that we got a 86% accuracy.


Then we are going to save the weights and architecture of the trained model for
future use.
Part 2:
We are going to use the Flask Framework to make a simple WebApp with our Model
running on the server which provides a simple UI for the prediction purposes.

0.4 Code Overview


PART 1: Jupyter Notebook
1. Importing all the required Packages:

2. Defining the Model Architecture:


4

3. All the Images and their respective Labels are being saved into 2 separate arrays:

4. Converting arrays into Numpy arrays:


5

5. Splitting of Train and Test data in 3:1 ratio:

6. One hot encoding for all 12 target classes:

7. Setting up the ImageDataGenerator for Data Augmentation:

8. Initializing Adam Optimizer and Starting Training:


6

9. Code for Printing Classification Report and Plots for visualizing Train loss, Val
loss, Train acc, Val acc:

10. Classification Report:


7

11. Plot between Loss and Accuracy:


8

12. Importing Package for Saving and Loading the Model:

13. Saving the Model:

14. Loading the saved model:

15. Setting Optimizer for Loaded model:


9

16. Testing the Loaded model for prediction:

17: Prediction Output:


10

PART 2: Making of Flask Web App


1. Importing all the required Packages:

2. Initializing App and a Directory path for the images which are uploaded:

3. Initial routing to upload.html :

4. Route to prediction api when Image submitted :


11

5. Loading the model:

6. Saving uploaded image to a folder and Predicting the Number Class:


12

7. Converting binary class into Name class and sending the response:

8. Sending response to the results page:

9. Running the App:


13

10. Content of upload.html file:

11. Content of results.html file:


14

0.5 Usage
5.
3.
8.
1.
6.
4.
2.
7. Clone the GitHub Repo and extract it.

2. Open terminal.

3. Navigate to the Extracted folder.

4. Install Virtual Environment.

5. Intall packages mentioned in requirements.txt

6. Enter "flask run" command.

7. Navigate to https://localhost:5000/ to use the Prediction App.

0.6 Conclusion

1. Atlast we made and deployed a Plant Prediction WebApp.


2. You can find the Jupyter Notebook Kernel on https://www.kaggle.com/ramganeshguptha/
plant-seedling-classification-among-12-species.
3. You can find the Code on my Github
https://github.com/Ramganeshsoma/Plant-Prediction-Web-App-using-Deep-Learning
4. You are free to give a feedback and try leaving a Star on the Repo.

Das könnte Ihnen auch gefallen