A modern, web-based application for detecting and classifying plant diseases using deep learning. Built with Flask and TensorFlow, featuring a beautiful, farmer-friendly interface with real-time camera integration.
- Features
- Supported Plants & Diseases
- Installation
- Usage
- Project Structure
- Technologies Used
- Model Architecture
- UI/UX Features
- API Endpoints
- Contributing
- License
- 38 Disease Classes: Classifies diseases across 9 different plant types
- High Accuracy: CNN-based model trained on large dataset
- Real-time Analysis: Fast prediction on uploaded images
- Health Report: Professional results display with disease badges
- File Upload: Upload images from your device
- Direct Camera Capture: Take photos directly using device camera
- Camera Switching: Toggle between front and back cameras
- Live Preview: Real-time camera feed with viewfinder overlay
- Fertilizer Recommendations: Specific fertilizer advice for each disease
- Treatment Tips: Practical tips for disease management
- Tabbed Interface: Easy navigation between fertilizer and tips
- Expert Guidance: Detailed recommendations based on disease type
- Agricultural Theme: Deep forest green (#2D5A27) and earthy gold (#D4A373) color scheme
- Responsive Design: Fully optimized for mobile and laptop
- Card-Based Layout: Clean, modern card design
- Smooth Animations: Fade-in effects and scanning animations
- High Contrast: Optimized for outdoor/sunlight viewing
- Hamburger Menu: Collapsible navigation on mobile
- Large Touch Targets: Minimum 50px buttons for easy tapping
- Full-Width Layout: 95% width on mobile devices
- Camera Integration: Native camera access on mobile devices
- Two-Column Layout: Side-by-side upload and camera options
- Full Navigation: Always-visible navigation bar
- Optimized Spacing: Professional desktop layout
The system can detect diseases in the following plants:
- Bacterial Spot
- Healthy
- Bacterial Blight (CBB)
- Brown Streak Disease (CBSD)
- Green Mottle (CGM)
- Healthy
- Mosaic Disease (CMD)
- Cercospora Leaf Spot (Gray Leaf Spot)
- Common Rust
- Healthy
- Northern Leaf Blight
- Black Rot
- Esca (Black Measles)
- Healthy
- Leaf Blight (Isariopsis Leaf Spot)
- Anthracnose Fungal Leaf Disease
- Healthy Leaf
- Rust Leaf Disease
- Early Blight
- Healthy
- Late Blight
- Brown Spot
- Healthy
- Hispa
- Leaf Blast
- Healthy Leaf
- Rust
- Sawfly Slug
- Bacterial Spot
- Early Blight
- Healthy
- Late Blight
- Leaf Mold
- Mosaic Virus
- Septoria Leaf Spot
- Spider Mites (Two-Spotted Spider Mite)
- Target Spot
- Yellow Leaf Curl Virus
Total: 38 Disease Classes
- Python 3.8 or higher
- pip (Python package manager)
git clone <repository-url>
cd Plant_Disease_Classificationpython -m venv venvWindows:
.\venv\Scripts\Activate.ps1Linux/Mac:
source venv/bin/activatepip install -r requirements.txtThe model file (Team3model.h5) is too large for GitHub. Download it from Google Drive:
π₯ Download Team3model.h5 from Google Drive
After downloading:
- Place the
Team3model.h5file in the project root directory - Ensure the file is named exactly
Team3model.h5 - The application will automatically load this model on startup
Note: The model file is required for the application to function. Without it, the disease detection feature will not work.
-
Activate Virtual Environment (if not already activated)
.\venv\Scripts\Activate.ps1 # Windows # or source venv/bin/activate # Linux/Mac
-
Run the Flask Application
python app.py
-
Access the Application
- Open your browser and navigate to:
http://localhost:5000 - The application will start on port 5000 by default
- Open your browser and navigate to:
-
Login
- Enter any email and password (authentication is bypassed for demo)
- Click "Login"
-
Upload or Capture Image
- Option 1: Click "Upload Image" and select a file from your device
- Option 2: Click "Open Camera" to capture a photo directly
-
View Results
- Disease name with color-coded badge (red for infected, green for healthy)
- Fertilizer recommendations tab
- Treatment tips tab
- Uploaded/captured image with scanning animation
-
Analyze Another Image
- Click "Analyze Another Image" to start over
Plant_Disease_Classification/
β
βββ app.py # Main Flask application
βββ requirements.txt # Python dependencies
βββ Team3model.h5 # Trained CNN model
βββ README.md # Project documentation
β
βββ static/
β βββ style.css # Shared stylesheet
β βββ uploads/ # Uploaded images directory
β
βββ templates/
β βββ login.html # Login page
β βββ home.html # Home page
β βββ disease-recognition.html # Disease detection page
β βββ prediction.html # Results page
β
βββ venv/ # Virtual environment (created after setup)
- Python 3.11: Programming language
- Flask 3.0.0: Web framework
- TensorFlow 2.15.0: Deep learning framework
- Keras 2.15.0: High-level neural networks API
- NumPy 1.24.3: Numerical computing
- Pillow 10.1.0: Image processing
- HTML5: Markup language
- CSS3: Styling with modern features
- JavaScript: Client-side interactivity
- Inter Font: Modern typography (Google Fonts)
- Convolutional Neural Network (CNN): Model architecture
- Image Preprocessing: Resizing, normalization
- Transfer Learning: Pre-trained model optimization
The CNN model consists of:
- Input Layer: 256x256x3 (RGB images)
- Convolutional Layers: Multiple Conv2D layers with ReLU activation
- Pooling Layers: MaxPooling2D for dimensionality reduction
- Dropout Layers: Regularization to prevent overfitting
- Dense Layers: Fully connected layers for classification
- Output Layer: 38 classes (softmax activation)
- Total Parameters: ~59 million
- Training Accuracy: ~65%
- Validation Accuracy: ~81%
- Test Accuracy: ~65%
The trained model file (Team3model.h5) is available for download:
Important:
- The model file is not included in the repository due to its large size
- You must download it separately and place it in the project root directory
- The file must be named
Team3model.h5for the application to work
- Primary Color: Deep Forest Green (#2D5A27)
- Accent Color: Earthy Gold (#D4A373)
- Background: Clean Off-White (#F8F9FA)
- Typography: Inter font family
- Border Radius: 16px for modern look
- Sticky Navigation Bar: Always accessible navigation
- Card-Based Layout: Clean, organized content cards
- Health Report Style Results: Professional disease report display
- Scanning Animation: Visual feedback during image processing
- Tabbed Interface: Easy navigation between fertilizer and tips
- Responsive Grid: Adapts to screen size
- Fade-in: Smooth page load animations
- Scanning Line: Green laser scan over uploaded images
- Button Hover: Scale and shadow effects
- Smooth Transitions: All interactive elements
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Redirects to login page |
| GET/POST | /login |
Login page and authentication |
| GET | /home |
Home page with features and supported plants |
| GET/POST | /disease-recognition |
Disease detection page (upload/camera) |
| GET | /logout |
Logout and redirect to login |
- Endpoint:
/disease-recognition - Method: POST
- Content-Type:
multipart/form-data - Field:
file(image file) - Response: Renders prediction page with results
Each disease includes:
- Specific fertilizer types (e.g., Potassium Sulfate, NPK 10-10-10)
- Application methods and timing
- Nutrient requirements
- Cultural practices
- Chemical treatments
- Prevention strategies
- Environmental management
Examples:
- Bacterial Diseases: Copper-based bactericides, pathogen-free seeds
- Fungal Diseases: Fungicides, proper spacing, crop rotation
- Viral Diseases: Vector control, resistant varieties
- Healthy Plants: Maintenance recommendations
- Hamburger menu navigation
- Single-column stacked layout
- Full-width buttons (95% screen width)
- Large touch targets (50px minimum)
- Camera view optimized for mobile
- Vertical scrolling only
- Full navigation bar
- Two-column layout for upload/camera
- Standard button sizes
- Side-by-side content arrangement
- Optimized spacing and padding
- Session Management: Flask sessions for user authentication
- File Upload Security: Secure filename handling
- Input Validation: Form validation on client and server
- Error Handling: Graceful error messages
Potential improvements:
- User authentication system
- Disease history tracking
- Export reports (PDF)
- Multi-language support (Telugu ready)
- Batch image processing
- Disease severity assessment
- Treatment cost calculator
- Integration with agricultural databases
Contributions are welcome! Please feel free to:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
This project is open-source and free to use under the MIT License.
The application runs with debug=True by default, enabling:
- Auto-reload on code changes
- Detailed error messages
- Development server
For production, set debug=False in app.py:
if __name__ == '__main__':
app.run(debug=False, host='0.0.0.0', port=5000)For issues, questions, or contributions, please open an issue on the repository.
πΎ Empowering farmers with AI-powered plant disease detection
Β© 2025 Plant Disease Classification System β All rights reserved.