A Machine Learning Tool to Prevent the Spread of Potato Diseases 🥔
Inspiration
🌪️
The devastating impact of potato diseases on global food security, with losses estimated to be in the billions, has long been a pressing concern for agricultural researchers and farmers alike.
However, accurate detection of these diseases remains a significant challenge, hindering our ability to develop effective management strategies and ensure a stable food supply.
Solution
🌱
-
Develop a machine learning model capable of detecting potato diseases using image data, leveraging the power of computer vision and deep learning to revolutionize the field of precision agriculture, as inspired by the innovative approaches of PlantVillage Insights.
-
Using a combination of convolutional neural networks (CNNs) and transfer learning to achieve high accuracy.
Dataset
📊
-
🌱 Potato Plant Diseases Data 🍂 is a comprehensive collection of images meticulously categorized into three distinct classes: early blight, late blight, and healthy.
-
Each class represents a specific condition affecting potato crops, enabling researchers and agricultural experts to delve into the intricacies of disease identification, progression, and management.
Methodology
🔍
- Data Preprocessing 🔄: Applying random transformations to the images to artificially increase the size of the training set using TF-keras pre-processing layers.
- Model Selection 🤔: Performance test accuracy and loss of 4 pre-trained models: RESNET, Inception, Xception & NASnetMobile
- Fine-tuning 🔩: Unfreezing the weights and training models on the augmented training data. Using learning rate reduction and early stopping callbacks to prevent overfitting.
- Hyperparameter Tuning 🔧: Using a grid search approach, Adam optimizer and sparse categorical cross-entropy loss.5.
- Prediction: Made on a random sample of images from the validation set. Incorrect predictions are also identified and visualized.
Model Architectures
🤖
- Xception: A deep learning model that uses a novel architecture to achieve state-of-the-art results on image classification tasks.
- ResNet50: A popular deep learning model that uses residual connections to ease the training process.
- Inception: A deep learning model that uses multiple parallel branches to capture features at different scales.
- NASNetMobile: A deep learning model that uses neural architecture search to find the optimal architecture for mobile devices.
Model Performance 📊
Model | Valid Dataset Accuracy | Test Dataset Accuracy |
---|---|---|
Xception | 0.9736 | 0.97 |
ResNet50 | 0.9950 | 0.99 |
Inception | 0.9577 | 0.95 |
NASNetMobile | 0.8999 | 0.92 |
Predicting
I’ve implemented a prediction function that takes an image as input and returns the predicted class label and confidence score.
def predict(model, img):
img_array = tf.keras.preprocessing.image.img_to_array(images[i].numpy())
img_array = tf.expand_dims(img_array, 0)
predictions = model.predict(img_array)
predicted_class = class_names[np.argmax(predictions[0])]
confidence = round(100 * (np.max(predictions[0])), 2)
return predicted_class, confidence
Acknowledgments
🙏
- Kaggle dataset: 🌱 Potato Plant Diseases Data 🍂
- TensorFlow and Keras libraries for deep learning
- Matplotlib and Seaborn libraries for data visualization
🙅♂️Disclaimer
This project is licensed under AGPL-3.0 License and is for personal use only and should not be used for commercial purposes. The pre-trained model and may not always produce accurate results.
Get Involved!
😌
This project demonstrates the potential of deep learning for potato diseases identification. The model achieves high accuracy and can be used as a starting point for further research and development in in precision agriculture.
I hope you found this project informative and engaging! 😊
If you’re interested in collaborating and contributing to the project, please let me know! I’d love to hear from you.
Getting Started
🚀
To get started with this project, you’ll need to:
- Install the required libraries, including TensorFlow, Keras, and OpenCV 📦
- Download the dataset from Kaggle 📈
- Run the code to train and evaluate the model 🤖
Enjoy working with the content! 😊