Skip to content

Abdelrahman968/pestector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

6 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸŒฟ Pestector - Plant Disease Detection System

License: MIT Python Node.js Deep Learning

An intelligent plant disease detection platform that leverages deep learning to identify plant diseases from leaf images. Built with a modern two-backend architecture for scalability and maintainability.


๐Ÿ“‹ Table of Contents


๐ŸŒŸ Overview

Pestector is a cutting-edge plant disease detection system designed to help farmers, agricultural professionals, and gardening enthusiasts identify plant diseases quickly and accurately. By simply uploading an image of a plant leaf, users receive instant diagnosis powered by state-of-the-art deep learning models.

Key Highlights

  • Real-time Disease Detection: Instant analysis of plant leaf images
  • 38 Disease Classes: Covers a wide range of crop diseases
  • 87,000+ Training Images: Trained on a comprehensive dataset
  • Two-Backend Architecture: Separation of concerns for better scalability
  • User-Friendly Interface: Clean, responsive web interface

๐Ÿ—๏ธ System Architecture

Pestector implements a Two-Backend Architecture to separate AI processing from application logic, enhancing scalability and maintainability.

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        Frontend Layer                        โ”‚
โ”‚           (Vanilla JS + HTML + Tailwind CSS)                โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   Node.js Backend Server                     โ”‚
โ”‚          (Application Logic & API Management)               โ”‚
โ”‚  โ€ข User Authentication & Authorization                      โ”‚
โ”‚  โ€ข Request Routing                                          โ”‚
โ”‚  โ€ข Database Management                                      โ”‚
โ”‚  โ€ข Static File Serving (from public/)                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚
                     โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                   Python AI Backend Server                   โ”‚
โ”‚              (Deep Learning & Image Processing)             โ”‚
โ”‚  โ€ข Image Preprocessing                                      โ”‚
โ”‚  โ€ข Deep Learning Model Inference                            โ”‚
โ”‚  โ€ข Disease Classification                                   โ”‚
โ”‚  โ€ข Prediction Results Generation                            โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Data Flow

  1. User uploads plant leaf image via web interface
  2. Frontend sends image to Node.js backend
  3. Node.js backend forwards image to Python AI backend
  4. Python AI backend processes image and runs ML model
  5. Classification results return to Node.js backend
  6. Node.js backend stores results in database
  7. Results displayed to user in real-time

Repository Structure


โœจ Features

Core Functionality

  • โœ… Image Upload: Support for common image formats (JPG, PNG, JPEG)
  • โœ… Real-time Analysis: Instant disease detection and classification
  • โœ… 38 Disease Categories: Comprehensive coverage of plant diseases
  • โœ… Confidence Scores: Prediction confidence for each classification
  • โœ… User Management: Secure authentication and user profiles
  • โœ… History Tracking: View past disease detections
  • โœ… Responsive Design: Works on desktop, tablet, and mobile

Advanced Features

  • ๐Ÿ”’ Secure Authentication: JWT-based user authentication
  • ๐Ÿ“Š Dashboard: User analytics and detection history
  • ๐ŸŽจ Modern UI: Clean interface built with Tailwind CSS
  • ๐Ÿš€ RESTful API: Well-documented API endpoints
  • ๐Ÿ“ฑ Mobile Responsive: Optimized for all screen sizes

๐Ÿ› ๏ธ Technology Stack

Frontend

  • JavaScript: Vanilla JS for lightweight performance
  • HTML5: Semantic markup
  • Tailwind CSS: Utility-first CSS framework
  • Fetch API: For HTTP requests

Node.js Backend

  • Runtime: Node.js 14+
  • Framework: Express.js
  • Database: MongoDB / PostgreSQL
  • Authentication: JWT (JSON Web Tokens)
  • File Upload: Multer
  • HTTP Client: Axios

Python AI Backend

  • Language: Python 3.8+
  • Deep Learning: TensorFlow / Keras / PyTorch
  • Image Processing: OpenCV, PIL
  • Web Framework: Flask / FastAPI
  • Data Processing: NumPy, Pandas

DevOps

  • Version Control: Git & GitHub
  • Containerization: Docker (optional)
  • API Testing: Postman

๐Ÿ“Š Dataset Information

The AI model is trained on the New Plant Diseases Dataset from Kaggle.

Dataset Details

  • Source: New Plant Diseases Dataset
  • Total Images: ~87,000 RGB images
  • Image Categories: 38 different classes
  • Image Types: Healthy and diseased crop leaves
  • Augmentation: Offline data augmentation applied

Dataset Split

Training Set   : 80% (~70,000 images)
Validation Set : 20% (~17,000 images)
Test Set       : 33 images (separate test folder)

Supported Plant Categories

The dataset covers various crops including:

  • ๐ŸŽ Apple (4 classes: healthy, apple scab, black rot, cedar rust)
  • ๐ŸŒฝ Corn (4 classes: healthy, cercospora, common rust, northern leaf blight)
  • ๐Ÿ‡ Grape (4 classes: healthy, black rot, esca, leaf blight)
  • ๐Ÿ‘ Peach (2 classes: healthy, bacterial spot)
  • ๐ŸŒถ๏ธ Pepper (2 classes: healthy, bacterial spot)
  • ๐Ÿฅ” Potato (3 classes: healthy, early blight, late blight)
  • ๐Ÿ“ Strawberry (2 classes: healthy, leaf scorch)
  • ๐Ÿ… Tomato (10 classes: healthy, various diseases)
  • And more...

๐Ÿš€ Installation

Prerequisites

  • Node.js 14+ and npm
  • Python 3.8+
  • MongoDB or PostgreSQL
  • Git

Clone Repositories

# Clone Node.js Backend
git clone https://github.com/Abdelrahman968/pestector-nodeJS.git
cd pestector-nodeJS

# Clone Python AI Backend
git clone https://github.com/Abdelrahman968/aibackend-pestector.git
cd aibackend-pestector

Setup Node.js Backend

cd pestector-nodeJS

# Install dependencies
npm install

# Create .env file
cp .env.example .env

# Configure environment variables
# Edit .env with your database credentials, JWT secret, etc.

# Start the server
npm start

Setup Python AI Backend

cd aibackend-pestector

# Create virtual environment
python -m venv venv

# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On macOS/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Download the trained model (if not included)
# Place model file in /models directory

# Start the server
python app.py

Configuration

Node.js Backend (.env)

PORT=3000
MONGODB_URI=mongodb://localhost:27017/pestector
JWT_SECRET=your_secret_key_here
AI_BACKEND_URL=http://localhost:5000

Python AI Backend (config.py)

PORT = 5000
MODEL_PATH = './models/plant_disease_model.h5'
IMAGE_SIZE = (224, 224)
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg'}

๐Ÿ’ป Usage

Starting the Application

  1. Start Python AI Backend (Terminal 1):

    cd aibackend-pestector
    python app.py
  2. Start Node.js Backend (Terminal 2):

    cd pestector-nodeJS
    npm start
  3. Access the Application: Open your browser and navigate to http://localhost:3000

Using the Web Interface

  1. Register/Login: Create an account or log in
  2. Upload Image: Click "Upload" and select a plant leaf image
  3. View Results: See the disease prediction with confidence score
  4. Check History: View past detections in your dashboard

๐Ÿ“ก API Documentation

Node.js Backend Endpoints

Authentication

POST /api/auth/register
POST /api/auth/login
POST /api/auth/logout
GET  /api/auth/me

Disease Detection

POST /api/detect
GET  /api/detections
GET  /api/detections/:id
DELETE /api/detections/:id

User Management

GET  /api/users/profile
PUT  /api/users/profile
GET  /api/users/history

Python AI Backend Endpoints

Prediction

POST /predict

Request Body (multipart/form-data):

{
  "file": "<image_file>"
}

Response:

{
  "success": true,
  "prediction": {
    "class": "Tomato___Late_blight",
    "confidence": 0.95,
    "disease_name": "Late Blight",
    "plant_type": "Tomato"
  },
  "timestamp": "2026-02-04T10:30:00Z"
}

Health Check

GET /health

Response:

{
  "status": "healthy",
  "model_loaded": true,
  "version": "1.0.0"
}

๐Ÿ“ Project Structure

Node.js Backend

โ”œโ”€โ”€ ๐Ÿ“ config
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ config.js
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ index.js
โ”œโ”€โ”€ ๐Ÿ“ controllers
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ index.js
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ recommendationController.js
โ”œโ”€โ”€ ๐Ÿ“ middleware
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ auth.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ guest.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ index.js
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ isAdmin.js
โ”œโ”€โ”€ ๐Ÿ“ models
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Analytics.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ AuditLog.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Chat.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Comment.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Contact.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ GuestUser.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ History.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ ModelFeedback.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Notification.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Plant.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Post.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Recommendation.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Reminder.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ Subscription.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ TreatmentPlan.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ TwoFactorCode.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ User.js
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ index.js
โ”œโ”€โ”€ ๐Ÿ“ public
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ css
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ img
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ articles
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ artic1.webp
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ artic2.jpg
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ artic3.webp
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ new
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Early-Blight-Disease-Treatment-Control-2048x1152.webp
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ test.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ appstore.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ goolgeplay.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ image.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ plant-background.jpg
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ plant.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ step1.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ step2.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ step3.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ step4.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ user-profile.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ user1.png
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ user2.png
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ user3.png
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ not-now
โ”‚   โ”‚   โ”œโ”€โ”€ ๐ŸŒ admin-new.html
โ”‚   โ”‚   โ”œโ”€โ”€ ๐ŸŒ admin.html
โ”‚   โ”‚   โ”œโ”€โ”€ ๐ŸŒ adminSub.html
โ”‚   โ”‚   โ”œโ”€โ”€ ๐ŸŒ doc.html
โ”‚   โ”‚   โ””โ”€โ”€ ๐ŸŒ research-papers.html
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ plants
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Blueberry
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Blueberryhealthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Cherry
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ CherryPowderymildew.JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Cherryhealthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Corn
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ CornCommonRust1.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Corn_(maize)Cercospora_leaf_spot Gray_leaf_spot.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Corn_(maize)___Northern_Leaf_Blight.JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Corn_(maize)___healthy.jpg
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Grape
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Grape___Black_rot.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Grape___Esca_(Black_Measles).JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Grape___Leaf_blight_(Isariopsis_Leaf_Spot).JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Grape___healthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Orange
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Orange___Haunglongbing_(Citrus_greening).JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Peach
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Peach___Bacterial_spot.JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Peach___healthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Pepper
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Pepper,_bell___Bacterial_spot.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Pepper,_bell___healthy.JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Potato___Early_blight.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Potato
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Potato___Early_blight.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Potato___Late_blight.JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Potato___healthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Raspberry
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Raspberry___healthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Soybean
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Soybean___healthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Squash
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Squash___Powdery_mildew.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Strawberry
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Strawberry___Leaf_scorch.JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Strawberry___healthy.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“ Tomato
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Bacterial_spot.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Early_blight.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Late_blight.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Leaf_Mold.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Septoria_leaf_spot.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Spider_mites Two-spotted_spider_mite.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Target_Spot.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Tomato_Yellow_Leaf_Curl_Virus.JPG
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___Tomato_mosaic_virus.JPG
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Tomato___healthy.JPG
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“ apple
โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ AppleBlackrot.JPG
โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ AppleCedarRust1.JPG
โ”‚   โ”‚       โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ AppleScab1.JPG
โ”‚   โ”‚       โ””โ”€โ”€ ๐Ÿ–ผ๏ธ Applehealthy.JPG
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ scripts
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ admin.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ contact.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ dashboard.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ forgot-password.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ header.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ history.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ library.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ login.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ plant.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ profile.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ recommendations.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ reminders.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ reset-password.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ scan.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ subscribe.js
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ treatment.js
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ“„ weather.js
โ”‚   โ”œโ”€โ”€ ๐ŸŒ about-us.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ adding-files.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ adminSub.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ advertisement.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ contact.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ dashboard.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ disease-library.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ dmca.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ donate.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ forgot-password.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ help.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ history.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ home.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ index.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ indexdev.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ login.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ official-rules.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ plants.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ privacy-policy.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ profile.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ recommendation.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ register.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ reminders.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ reset-password.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ scan.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ subscribe.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ terms.html
โ”‚   โ”œโ”€โ”€ ๐ŸŒ treatment.html
โ”‚   โ””โ”€โ”€ ๐ŸŒ weather.html
โ”œโ”€โ”€ ๐Ÿ“ routes
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ admin.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ adminSubscriptions.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ analytics.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ auth.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ chat.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ classify.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ contact.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ feedback.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ forum.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ general.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ guest.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ history.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ index.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ notification.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ plants.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ posts.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ recommendationRoutes.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ reminders.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ reports.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ subscription.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ treatment.js
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ weather.js
โ”œโ”€โ”€ ๐Ÿ“ test
โ”œโ”€โ”€ ๐Ÿ“ uploads
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ 2ab9d227-2420-4f26-974e-474e252854e0
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ PotatoHealthy2-1746978295916-4cee9211.jpeg
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ b2600118-800px-wm-1751451383175-fb364c64.jpg
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ 4c642cbd-b51a-4ca8-8ab5-5e0dace3cf67
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ AppleCedarRust1-1752247645794-24f28feb.JPG
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ 548d8f65-b5f7-42ad-b928-846e8d5baa93
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ AppleCedarRust1-1742793756033.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ AppleCedarRust1-1742794028211.JPG
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ AppleScab1-1742793998340.JPG
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ 67cf8380ee7c7f4c3915d14d
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ CornCommonRust1-1741655108883.JPG
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ 67cf862b1728ed3ffc473bfc
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ 00a6039c-e425-4f7d-81b1-d6b0e668517e___RS_HL 7669-1741656219547.JPG
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ ......
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ 67d07c15b4acd2eca111e638
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ 04-1744578691532.jpg
โ”‚   โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ AppleBlackrot-1742571106731.JPG
โ”‚   โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ ......
โ”œโ”€โ”€ ๐Ÿ“ utils
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ formatDate.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ index.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ mailer.js
โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ recommendationEngine.js
โ”‚   โ””โ”€โ”€ ๐Ÿ“„ whatsappValidation.js
โ”œโ”€โ”€ โš™๏ธ .gitignore
โ”œโ”€โ”€ ๐Ÿ“„ app.js
โ”œโ”€โ”€ ๐Ÿ“„ log.txt
โ”œโ”€โ”€ โš™๏ธ package-lock.json
โ”œโ”€โ”€ โš™๏ธ package.json
โ”œโ”€โ”€ ๐Ÿ“„ server.js
โ”œโ”€โ”€ ๐Ÿ“„ staticRoutes.js
โ””โ”€โ”€ ๐Ÿ“„ test-email.js

Python AI Backend

aibackend-pestector/
โ”œโ”€โ”€ models/  # Trained ML models
โ”‚   โ”œโ”€โ”€ plant_disease_vit_BEST_model_state.pth         
โ”‚   โ””โ”€โ”€ vgg_model.h5
โ”œโ”€โ”€ static/ # Simple UI
โ”‚   โ””โ”€โ”€ HTML,CSS,JS Files          
โ”œโ”€โ”€ uploads/ # User Images
โ”‚   โ””โ”€โ”€ ...images.png          
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ treatment_recommendations.json
โ”œโ”€โ”€ reason.json
โ”œโ”€โ”€ app_combined_v2_2_5.log    # Log File
โ””โ”€โ”€ app.py             # FastAPI app

๐Ÿ“ˆ Model Performance

Training Metrics

  • Training Accuracy: ~98%
  • Validation Accuracy: ~96%
  • Test Accuracy: ~95%
  • Training Time: ~2 hours on GPU
  • Model Size: ~50 MB

Performance Benchmarks

  • Average Prediction Time: < 500ms
  • Image Preprocessing: < 100ms
  • Model Inference: < 300ms
  • Response Time (End-to-End): < 1s

Confusion Matrix

The model shows high accuracy across all 38 classes with minimal misclassification between visually similar disease categories.


๐Ÿค Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style
  • Write descriptive commit messages
  • Add tests for new features
  • Update documentation as needed

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


๐Ÿ™ Acknowledgments

  • Dataset: New Plant Diseases Dataset by Samir Bhattarai
  • Deep Learning Framework: TensorFlow/Keras team
  • Community: Open-source contributors and agricultural technology enthusiasts

๐Ÿ“ž Contact


๐Ÿ”ฎ Future Enhancements

  • [โœ…] Mobile application (iOS & Android)
  • Real-time camera detection
  • [โœ…] Treatment recommendations
  • Multilingual support
  • Offline mode capability
  • Integration with IoT sensors
  • [โœ…] Advanced analytics dashboard
  • [โœ…] Community forum for farmers

๐Ÿ“ธ Screenshots

Coming soon


Made with โค๏ธ for sustainable agriculture

About

An intelligent plant disease detection platform that leverages deep learning to identify plant diseases from leaf images. Built with a modern two-backend architecture for scalability and maintainability.

Resources

License

Stars

Watchers

Forks

Contributors