Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

React Python Flask TensorFlow

🌱 AgroGuard

An Intelligent Plant Disease Detection and Management System

OverviewFeaturesTech StackML EngineRun Locally


🌟 Overview

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!)

AgroGuard Preview

✨ Features

  • 📸 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.

🛠 Tech Stack

Frontend

  • Framework: React 19 + Vite
  • Styling: Tailwind CSS
  • Icons: Lucide React
  • Requests: Axios

Backend

  • Framework: Flask (Python)
  • CORS Management: Flask-CORS
  • File Handling: Secure multi-part upload processing

Machine Learning

  • Core Library: TensorFlow >=2.15.0
  • Image Processing: OpenCV, NumPy
  • Data Engineering: Pandas

🚀 Run Locally

Ensure you have Node.js and Python 3.9+ installed on your machine.

1. Clone the repository

git clone https://github.com/your-username/agroguard.git
cd agroguard

2. Train the AI Model

Before 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).

  1. Download Dataset: Go to Plant Disease Dataset on Kaggle.
  2. Extract Files: Extract the dataset into AgroGuard/ml_pipeline/archive/PlantVillage/ (you should see folders like Tomato_Bacterial_spot inside).
  3. 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.py

This will automatically train the model and copy agroguard_model.h5 and class_indices.json into your backend/ folder!

3. Set up the Backend API

cd ../backend
python -m venv venv
source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
pip install -r requirements.txt
python app.py

The Backend API will be available at http://localhost:5001

4. Set up the Frontend

Open a second terminal and execute:

cd AgroGuard/frontend
npm install
npm run dev

Your React app will run locally on http://localhost:5173. Open this URL in your browser to start diagnosing!

🧠 Machine Learning Engine

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.

Developed with ❤️ for a sustainable future.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages