'Potato Life' is an automated project for farmers for timely and accurate diagnosis of diseases in potato leaves.
- Potato(Solanum tuberosum) is the fourth-most important staple crop in the world.
- Potato crops are susceptible to multiple diseases.
- This project identifies and classifies major potato diseases.
- By accurately diagnosing diseases, farmers can apply targeted treatments, reducing the need for excessive pesticide use.
- Potato crops are highly vulnerable to diseases, impacting yield and food security.
- Early, precise disease detection is crucial for efficient management and reduced crop loss.
- Traditional diagnosis methods are slow and unsuitable for large-scale agriculture.
- There's a need for automated, scalable solutions for disease detection.
- We have used publicly available ‘PlantVillage’ dataset.
- It includes 1000 images each of ‘Early Blight’ and ‘Late Blight’, along with 152 ‘Healthy’ leaf images, totalling 2152 potato leaf images.
- Data Batch Loading: Into 68 batches of 32 images each
- Data Partitioning: Into train, test and validation sub-datasets
- Data Resizing: To a constant size of 256 X 256
- Data Rescaling: Divided pixel intensities of each image by 255.
- Data Augmentation: As random flipping and random rotation
- CNN Model Architecture: Consisted of-
- 6 convolutional layers with 3X3 kernel size and ReLU activation function
- 6 max-pooling layers
- A dropout layer
- A flattening layer
- 2 dense layers
- Compiled the model using Adam optimizer, Sparse categorical cross-entropy loss and Accuracy metric.
- The training process involved 50 epochs, with each epoch comprising 54 steps.
-
Implementation details:
- Endpoint Creation: We developed a FastAPI server on localhost, listening on port 8000.
- Endpoint Routes: We implemented the Post / Predict API route to facilitate interaction with the model. This route accepts an uploaded potato leaf image, processes it, feeds it into our trained model, and returns the predicted class (early blight, late blight, or healthy) along with a confidence score.
-
Image Processing and Model Prediction Upon receiving an image upload through the /predict endpoint, FastAPI performs the following steps:
- Image Conversion: FastAPI converts the uploaded image into a NumPy array.
- Tensor Conversion: The NumPy array is further transformed into a tensor, which is compatible with our trained model.
- Model Prediction: The tensorized image is passed through the model, and the model predicts the disease class and provides a confidence score for the prediction.
-
Response Format
-
Upon completion of training, our model achieved a remarkable test accuracy of 98.83%, demonstrating the model's efficacy in classifying potato leaves into three categories: early blight, late blight, and healthy conditions.
-
Alongside, we have the model’s predictions on a sample of test images, where: “Actual" represents the true class. “Predicted represents the predicted class. “Confidence" is the confidence score associated with the prediction, which reflects upon the reliability of the model's decision.
-
Postman software interacting with the model via API request and giving prediction result as a json response for a sample leaf image.
- Robust Data Preparation: Data preprocessing, involving batch loading, resizing, rescaling, and data augmentation, enhanced dataset quality and diversity.
- Model achieved an impressive 98.83% test accuracy, showcasing deep learning's effectiveness in disease classification.
- User-Friendly Implementation: FastAPI and Postman software facilitated user-friendly disease classification, empowering farmers and experts for on-the-spot diagnosis.
- Effectively address timely and accurate detection of potato leaf diseases.
- Create a mobile app
- Emphasize on the need for FastAPI server security, including measures like authentication and authorization to safeguard model and user data.
- Implement monitoring and logging tools to track server performance, usage, and errors.
- Implement a feedback mechanism to collect user input for ongoing model enhancements.
- S. Biswas, B. Jagyasi, B. P. Singh and M. Lal, "Severity identification of Potato Late Blight disease from crop images captured under uncontrolled environment," 2014 IEEE Canada International Humanitarian Technology Conference - (IHTC), Montreal, QC, Canada, 2014, pp. 1-5, doi: 10.1109/IHTC.2014.7147519.
- G. Athanikar and P. Badar, “Potato Leaf Diseases Detection and Classification System”, IJCSMC, Vol. 5, Issue. 2, February 2016, pg.76 – 88
- Rabbia Mahum, Haris Munir, Zaib-Un-Nisa Mughal, Muhammad Awais, Falak Sher Khan, Muhammad Saqlain, Saipunidzam Mahamad & Iskander Tlili. A novel framework for potato leaf disease detection using an efficient deep learning model, Human and Ecological Risk Assessment: An International Journal; 2022.
- Chakraborty KK, Mukherjee R, Chakroborty C, Bora K. Automated recognition of optical image based potato leaf blight diseases using deep learning. Physiological and Molecular Plant Pathology. 2022;117:101781
- Python
- FastAPI
Krishna Dubey (DL and Backend), Pankaj Kumar Giri (Backend)