## Inspiration

I have a Mango Farm of over 200 Trees, these are prone to diseases like powdery mildew, anthracnose, die back, blight, red rust, sooty mould, etc. and once it gets affected to one plant it keeps spreading. To avoid this I have created a Machine Learning Model to detect if plant is unhealthy or not using images of leaves . The inference of this model is Optimised by OpenVino and gaining Inference Speed over 72 times than Normal version.

## What it does

1. Farmers can easily find out if their plants are affected or not.
2. By using OpenVino the Inference becomes much fast (0.005 Seconds per Image) so it doesn't take much amount of time.
3. It can be easily integrated to Embedded Devices using Intel Compute Stick and Drones.
4. Due to this it will take less amount of pesticides as we know which plants are infected.

## How I built it

The training and inference of model is done on Intel Xeon and Ubuntu 18.04. The dataset is used from here. I have used Tensorflow 2.0 for training and OpenVino 20.4 for Inference. When we add images of leaf for input it outputs probability and flag if leaf has disease or not.

#### Algorithm:

It is a Classification Problem so I will be using CNN with Convolution and Max Pooling Layers.

``````Layer (type)                 Output Shape              Param #
=================================================================
conv2d (Conv2D)              (None, 180, 180, 16)      448
_________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 90, 90, 16)        0
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 90, 90, 32)        4640
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 45, 45, 32)        0
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 45, 45, 64)        18496
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 22, 22, 64)        0
_________________________________________________________________
dropout (Dropout)            (None, 22, 22, 64)        0
_________________________________________________________________
flatten (Flatten)            (None, 30976)             0
_________________________________________________________________
dense (Dense)                (None, 128)               3965056
_________________________________________________________________
dense_1 (Dense)              (None, 2)                 258
=================================================================
Total params: 3,988,898
Trainable params: 3,988,898
Non-trainable params: 0
``````

#### Training:

Model is trained using Tensorflow and Adam Optimiser on 15 epochs and saved in.h5 model file.

#### Running Inference without OpenVino:

We use Tensorflow's predict function to test our model.

``````predictions = model.predict(test_data)
``````

Results:

20 Images takes 7.34 Seconds to Infer. Average: 0.367 Seconds/Image

#### Running Inference with OpenVino:

Steps(All are explained in Colab Notebook):

1. Converting.h5 model to.pb (frozen model)

2. Converting.pb (frozen model) to.xml and.bin file required for OpenVino.

3. Running the final inference model usinf OpenVino's Python Libraries.

Results:

20 Images takes 0.118 Seconds to Infer Average: 0.0059 Seconds/Image

#### Inference Results :

Shows Percent of Detection of Disease

## Challenges I ran into

1. Dataset Collection was difficult
2. Deploying it into Drone was little tricky due to hardware limitations

## Accomplishments that I'm proud of

• Due to this project use of pesticides will be reduced.
• Helping Farmers to increase their Harvest and save their time.

## What I learned

• Using and Testing with OpenVino Inference Engine
• Experience with different types of diseases in farms.

## What's next for Mango Plant Disease Detection

1. Using this model on Drones with Raspberry Pi and Compute Stick
2. Adding more features to Model like detecting type of Disease