Skip to content

A multi-target leaf disease detection model. It can detect 7 types of leaves and 4 types of diseases.

License

Notifications You must be signed in to change notification settings

sheikhDeep/Leaf-disease-detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Leaf Disease Detection

Motive

The purpose of this project is to create an application that can detect various kinds of leaf diseases. This app can detect the name of the leaf. It can also detect if the leaf is diseased or not and will also tell the disease name. It can detect seven kinds of leaves and their diseases. The leaves are - Banana, Cucumber, Mango, Maple, Pepper, Rose, Tomato. The diseases are - Sigatoka, Powdery-mildew, Anthracnose, Leaf-spot.

Data Collection

I collected my data manually. I tried to collect data automatically with the help of tools like selenium but it was not giving me accurate images. So I choose to collect data manually by Google search.

Data Preprocessing and Image Augmentation

Healthy images were available on the internet but there were not many images available of the diseased leaves. As my dataset is small I had to augment images for increasing the number of images.

Number of Images after augmentation :

Leaf Name Total Healthy Diseased
Maple 1216 448 768
Banana 704 472 232
Rose 2432 1488 944
Mango 1944 1248 696
Cucumber 768 416 352
Tomato 1872 1336 536
Pepper 784 456 328

Model Training

For better performance and time effect I choose 'Fastai' and 'Pytorch'. For training, I tried two models resnet-34 and resnet-18, and saved the best-performing model for future use. Both models gave 99% accuracy. restenet-18 was faster than restnet-34 so I selected restnet-18.

Final Model Selection

Trained 4 models. Here are their results.

Model Accuracy F1_score Precision Time
Resnet18 0.998834 0.928576 0.930272 01:38
Resnet34 0.999863 0.932688 0.932644 02:11
AlexNet 0.979863 0.913688 0.912644 03:15
GoogleNet 0.999108 0.930197 0.930705 01:39

As resnet34 and resnet18 both reach 99% Accuracy, another score is way close, but resnet18 is a bit faster. So I chose resnet18 for further work.

Model size Compression

Model compression is very essential. By compressing the models with ONNX, you can achieve smaller model sizes, faster inference times, and reduced memory requirements. Model compression code can be found in the notebook /leaf-disease-detection.ipynb file.

Deployment

I deployed my project in HuggingFace. You can see this from here.

Interface

I also deployed the app using flask on render.com. You will find the code in the flask-deployment branch. The UI of the application is simple. Here is the link

About

A multi-target leaf disease detection model. It can detect 7 types of leaves and 4 types of diseases.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published