Prototype: https://youtu.be/OE9KS9Ulcos?si=G_Co71CIU6b5h9o2
Research Paper: https://docs.google.com/document/d/16dlcJQwMlwsY-dh49TIpj6FXRT9mQ0T65wFbP-Y_faE/edit?tab=t.0
GreenGuard is an AI-powered, interactive web application designed to assist farmers and agricultural specialists in detecting and identifying plant diseases using image-based diagnostics. By leveraging the AGDFNet (Attention-Guided Multi-Scale Disease Feature Network) deep learning model, the system provides real-time disease identification, treatment recommendations, and preventive insights, all integrated into an intuitive chatbot interface.
- Upload or capture leaf images for instant analysis
- Offline model inference using AGDFNet architecture
- Real-time feedback with disease probability scores
- Support for both online and offline modes
- Comprehensive coverage of 61 disease classes
- Support for 11 major crop types:
- Bean
- Cotton
- Groundnut
- Maize
- Pepper Bell
- Potato
- Rice
- Spinach
- Sugarcane
- Tomato
- Turmeric
- Class-specific precision, recall, and F1-scores
- Disease probability heatmaps
- Growth stage analysis
- Severity assessment
- Environmental factor correlation
- Personalized treatment prescriptions
- Preventive measures and best practices
- Fertilizer recommendations
- Integrated pest management suggestions
- Seasonal care guidelines
- Interactive diagnosis conversations
- Treatment recommendations
- Fertilizer information
- Location-based mapping
- Weather integration
- Growth stage advice
- Comprehensive scan history
- Progress tracking
- Treatment effectiveness analysis
- Exportable reports
- Seasonal comparison
- Growth pattern analysis
- Offline model inference
- Online treatment recommendations
- Camera integration
- Mobile-friendly UI
- Offline storage
- Network-optimized images
- Upload or capture a crop leaf image
- Support for JPG, PNG, and JPEG formats
- Maximum file size: 5MB
- Real-time image preview
- Image processed through AGDFNet
- Multi-scale feature extraction
- Attention-based disease localization
- Real-time probability calculation
- Display of detected disease class
- Probability score visualization
- Treatment recommendations
- Prevention measures
- Export options
- Ask questions about diagnosis
- Get localized advice
- Treatment follow-up
- Prevention queries
- Growth stage information
- Access previous scans
- Compare results
- Track treatment progress
- Export historical data
- Analyze patterns
-
Error: Unsupported file format
- Solution: Use JPG, PNG, or JPEG only
- Tip: Convert images using free tools
-
Error: File size too large
- Solution: Compress image before upload
- Tip: Use image compression tools
- Error: Flask server not running
- Solution: Start backend server
- Command:
python backend.py
- Port: 5000
- Error: Missing model file
- Solution: Place
adgf_net.keras
inmodels/
- Location:
backend/models/adgf_net.keras
- Tip: Verify file permissions
- Solution: Place
- Error: API key not found
- Solution: Check
.env
file - Variable:
GROQ_API_KEY
- Tip: Get key from Groq Dashboard
- Solution: Check
- Framework: React 18+
- Build Tool: Vite
- Styling: TailwindCSS
- Animations: Framer Motion
- UI Components: Material UI
- State Management: React Context
- Image Processing: HTML5 Canvas
- Framework: Flask 2.x
- CORS: Flask-CORS
- ML Integration: TensorFlow 2.x
- Chat Integration: LangChain
- API Routing: Flask-RESTful
- Error Handling: Flask-Error
- Model Architecture: AGDFNet
- Loss Function: Adaptive Focal Loss
- Attention Mechanisms: Spatial & Channel Attention
- Transfer Learning: Pre-trained CNN
- Optimization: AdamW
- Metrics: Precision, Recall, F1-Score
- Session Management: SessionStorage
- Image Storage: Temporary filesystem
- History: IndexedDB
- Cache: Redis (optional)
- LLM Provider: Groq
- Weather API: OpenWeatherMap
- Geolocation: Geolocation API
- Image Processing: Pillow
- Database: SQLite (optional)
- Node.js (v18+)
- Python (v3.9+)
- NPM or Yarn
- Internet connection for API calls
- Git
- Python virtual environment
# Clone the repository
$ git clone <repository-url>
$ cd GreenGuard
# Install dependencies
$ npm install
# Run development server
$ npm run dev
# Access the application at http://localhost:5173
# Navigate to the backend directory
$ cd backend
# Create and activate virtual environment
$ python -m venv venv
# On Windows:
$ venv\Scripts\activate
# On macOS/Linux:
$ source venv/bin/activate
# Install dependencies
$ pip install -r requirements.txt
# Run the backend server
$ python backend.py
# The API will be available at http://localhost:5000
- Create a
.env
file in the backend directory with:
GROQ_API_KEY=your_groq_api_key
OPENWEATHER_API_KEY=your_openweather_api_key
- Get your API keys from:
- Groq Dashboard: https://console.groq.com
- OpenWeatherMap: https://openweathermap.org/api
GreenGuard/
βββ backend/ # Python Flask API
β βββ models/ # ML model files
β β βββ adgf_net.keras # Custom CNN model
β βββ temp_uploads/ # Temporary storage for uploaded images
β βββ backend.py # Main Flask application
β βββ disease_predict.py # ML model implementation
β βββ groq_demo.py # Integration with Groq API
β βββ requirements.txt # Python dependencies
β
βββ src/ # React frontend
β βββ assets/ # Static assets
β βββ components/ # Reusable UI components
β βββ context/ # React context providers
β βββ hooks/ # Custom React hooks
β βββ pages/ # Application pages
β βββ App.jsx # Main application component
β βββ App.css # Application styles
β βββ index.css # Global styles
β βββ main.jsx # Entry point
β
βββ public/ # Public static files
βββ .gitignore # Git ignore rules
βββ package.json # NPM dependencies
βββ tailwind.config.js # Tailwind CSS configuration
βββ vite.config.js # Vite configuration