CropGuardian is an AI-powered application designed to classify diseases in crops such as tomatoes, potatoes, and peppers. It can also classify five different crops - wheat, jute, sugarcane, rice and maize. It leverages the EfficientNetB2 model, fine-tuned on a custom dataset, to provide accurate and efficient crop disease detection.
Crop diseases pose a significant threat to food security and agricultural productivity. Early and accurate detection of crop diseases can help mitigate these threats. CropGuardian is developed to assist farmers and agricultural experts by providing a reliable tool for crop disease identification.
- EfficientNetB2 Model: Utilizes a pre-trained EfficientNetB2 model for feature extraction and fine-tuned for specific crop diseases.
- Multi-Class Classification: Supports classification of multiple crop diseases including healthy, early blight, and late blight for tomatoes, potatoes, and peppers.
- User-Friendly Interface: Easy-to-use interface deployed on Hugging Face Spaces for real-time disease detection.
- Python 3.7 or higher
- Conda package manager
- Git
-
Clone the repository:
git clone https://github.com/yourusername/CropGuardian.git cd CropGuardian
-
Create a conda environment using the provided
environment.yml
file:conda env create -f environment.yml conda activate vision_env
-
Install the package:
pip install -e .
To run the application locally, use the following command:
python demos/app.py
You can also use the web app deployed on Hugging Face Spaces: CropGuardian on Hugging Face
The dataset used in this project consists of images of healthy and diseased crop leaves. The dataset is split into training and testing sets to evaluate the model's performance.
Training a model from scratch involves using the custom dataset to train a new Vision Transformer model. The training script to train ViT from scratch is located in training/ViT_scratch.py
.
python training/ViT_scratch.py
The training loss decreases but rises again and keeps flutuating. Our model is severely underfitting due to the smaller dataset.
The pre-trained EfficientNetB2 model is fine-tuned on the custom dataset. The fine-tuning script is located in training/train_model.py
.
python training/train_model.py
Include training loss and accuracy plots for the model trained from scratch.
Include training loss and accuracy plots for the fine-tuned pre-trained model.
These results highlight the advantages of using pretrained models, especially when working with small datasets. By including these visualizations and comparisons, we can effectively demonstrate the improvements achieved through transfer learning and the capabilities of the ViT architecture.
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.