An Intelligent Plant Disease Detection and Management System
Overview • Features • Tech Stack • ML Engine • Run Locally
AgroGuard is a full-stack, AI-driven agricultural platform designed to help farmers and gardeners identify plant diseases early. Through advanced Deep Learning models and a seamless user interface, AgroGuard provides instant diagnoses and customized treatment suggestions simply by uploading a photo of a plant leaf.
A final year project demonstrating proficiency in full-stack development, applied machine learning, and computer vision.
(Note: Add project screenshots below for visual appeal!)
- 📸 Instant Image Analysis: Upload a picture of a leaf for immediate processing.
- 🤖 Deep Learning Model: Uses a custom-trained TensorFlow/Keras model predicting diseases with high confidence.
- 💡 Actionable Insights: Get specifically tailored treatment suggestions to save the crops.
- ⚡ Real-time API: Lightning-fast inference via a robust Flask RESTful architecture.
- 🎨 Beautiful UI: Modern, responsive interface built with React, Vite, and TailwindCSS.
- Framework: React 19 + Vite
- Styling: Tailwind CSS
- Icons: Lucide React
- Requests: Axios
- Framework: Flask (Python)
- CORS Management: Flask-CORS
- File Handling: Secure multi-part upload processing
- Core Library: TensorFlow >=2.15.0
- Image Processing: OpenCV, NumPy
- Data Engineering: Pandas
Ensure you have Node.js and Python 3.9+ installed on your machine.
git clone https://github.com/your-username/agroguard.git
cd agroguardBefore running the backend, you must train the Machine Learning model. Our optimized training pipeline uses MobileNetV2 for blazing-fast CPU training (~10 mins for 5 epochs).
- Download Dataset: Go to Plant Disease Dataset on Kaggle.
- Extract Files: Extract the dataset into
AgroGuard/ml_pipeline/archive/PlantVillage/(you should see folders likeTomato_Bacterial_spotinside). - Run Training Script:
cd AgroGuard/ml_pipeline
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
python train.pyThis will automatically train the model and copy agroguard_model.h5 and class_indices.json into your backend/ folder!
cd ../backend
python -m venv venv
source venv/bin/activate # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
python app.pyThe Backend API will be available at http://localhost:5001
Open a second terminal and execute:
cd AgroGuard/frontend
npm install
npm run devYour React app will run locally on http://localhost:5173. Open this URL in your browser to start diagnosing!
The core of AgroGuard relies on an optimized MobileNetV2 convolutional neural network, fine-tuned to identify 15 different plant foliar conditions with high accuracy.
Our pipeline (ml_pipeline/) handles:
- Data Augmentation: Dynamic resizing (128x128), rotation, shifts, and flips to create a robust model.
- Fast Training: Initial training with a frozen base, followed by an automatic fine-tuning callback if accuracy falls below a threshold.
- Auto-Deployment: Script cleanly exports the H5 model and JSON class indices directly to the backend.
