AI-powered plant disease detection with 92% accuracy using Deep Learning
An intelligent web application that uses Convolutional Neural Networks (CNN) to detect plant diseases from images and provides AI-powered treatment recommendations.
- 🔍 Real-time Disease Detection - Identify 38 different plant diseases with 92% accuracy
- 🤖 AI Chat Assistant - Get personalized plant care advice powered by Claude AI
- 📊 Comprehensive Analysis - Detailed symptoms, causes, and treatment plans
- 💊 Treatment Solutions - Step-by-step remediation guides
- 🌿 Prevention Tips - Proactive care recommendations
- 📱 Responsive Design - Beautiful UI that works on all devices
⚠️ Confidence Warnings - Low confidence alerts when model needs more data
- 🍅 Tomato (10 diseases)
- 🥔 Potato (3 diseases)
- 🍎 Apple (4 diseases)
- 🌽 Corn (4 diseases)
- 🍇 Grape (4 diseases)
- 🍑 Peach (2 diseases)
- 🌶️ Pepper (2 diseases)
- 🍓 Strawberry (2 diseases)
- And more! (38 total plant conditions)
| Metric | Score |
|---|---|
| Validation Accuracy | 92% |
| Top-3 Accuracy | 98% |
| Training Images | 43,456 |
| Validation Images | 10,864 |
| Classes | 38 |
Backend:
- Python 3.12
- Flask 3.0
- TensorFlow 2.15
- Keras
Machine Learning:
- Transfer Learning (MobileNetV2)
- Image Preprocessing
- Data Augmentation
- CNN Architecture
Frontend:
- HTML5
- JavaScript (ES6+)
- Tailwind CSS
- Lucide Icons
AI Integration:
- Anthropic Claude API
- Natural Language Processing
- Context-aware responses
- Python 3.8 or higher
- pip (Python package manager)
- 4GB RAM minimum
- Internet connection (for AI chat)
1. Clone the repository
git clone https://github.com/learner0018/Plantcare-ai.git
cd plantcare-ai2. Create virtual environment
# Windows
python -m venv venv
venv\Scripts\activate
# Mac/Linux
python3 -m venv venv
source venv/bin/activate3. Install dependencies
pip install -r requirements.txt4. Download the trained model
The trained model file is too large for GitHub.
5. Set up environment variables
Create a .env file in the project root:
ANTHROPIC_API_KEY=your_api_key_hereGet your API key from: https://console.anthropic.com/
6. Run the application
python app.py7. Open in browser
http://localhost:5000
- Upload Image - Take or select a photo of the affected plant
- Analyze - Click "Analyze Plant" to process the image
- Review Results - See disease identification and confidence score
- Read Treatment - Follow the step-by-step treatment guide
- Ask Questions - Use the AI chat for personalized advice
plantcare-ai/
│
├── app.py # Main Flask application
├── model_handler.py # AI model inference
├── disease_database.py # Disease information database
├── ai_chat_handler.py # Claude AI integration
├── train_model.py # Model training script
├── requirements.txt # Python dependencies
├── .env # Environment variables (not in repo)
├── .gitignore # Git ignore rules
├── LICENSE # MIT License
├── README.md # This file
│
├── model/
│ ├── plant_model.h5 # Trained model (download separately)
│ ├── classes.txt # Disease class names
│ └── training_history.png # Training performance graph
│
├── templates/
│ └── index.html # Frontend UI
│
├── static/
│ └── js/
│ └── app.js # Frontend JavaScript
│
└── uploads/ # Temporary image storage (not in repo)
Input Image (224x224x3)
↓
MobileNetV2 (Pre-trained on ImageNet)
↓
Global Average Pooling
↓
Dense Layer (128 neurons, ReLU)
↓
Dropout (0.5)
↓
Output Layer (38 neurons, Softmax)
↓
Disease Prediction
- Data Collection - PlantVillage dataset (54,000+ images)
- Preprocessing - Resize, normalize, augment
- Transfer Learning - Fine-tune MobileNetV2
- Training - 10 epochs with validation
- Evaluation - 92% accuracy achieved
- Deployment - Export to .h5 format
If you want to retrain the model:
# Download dataset from Kaggle
# Place in dataset/color/ folder
# Run training script
python train_model.py
# Model will be saved to model/plant_model.h5- ✅ API keys stored in
.env(excluded from Git) - ✅ No sensitive data in code
- ✅ Secure file upload validation
- ✅ CORS protection enabled
- ✅ Input sanitization
Contributions are welcome! Here's how:
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Large model file requires separate download
- First API request may be slow (model loading)
- Limited to 38 plant disease classes currently
- Mobile app (React Native)
- Offline mode support
- More plant species
- Disease progression tracking
- Community forum
- Multiple language support
This project is licensed under the MIT License - see the LICENSE file for details.
- Dataset: PlantVillage Dataset from Kaggle
- Base Model: MobileNetV2 from TensorFlow
- AI Chat: Anthropic Claude API
- Icons: Lucide Icons
- Styling: Tailwind CSS
Aditya Singh
- GitHub: https://github.com/johnn021as
- LinkedIn: https://www.linkedin.com/in/aditya-singh-083b02351/
- Email: adityasinghdrdo70@gmail.com
Project Link: https://github.com/johnn021as/Plantcare-ai
⭐ If you found this project helpful, please give it a star! ⭐
Made with ❤️ and Python