Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🌾 Hyper-Local Pest Infestation Forecaster

An AI-powered system that predicts pest spread in agricultural areas using satellite imagery, weather data, and machine learning to provide 24-72 hour forecasts for targeted preventive action.

🎯 Project Overview

This project combines:

  • Satellite Data: Sentinel-2 imagery for NDVI calculation
  • Weather Data: Open-Meteo API for environmental conditions
  • Deep Learning: ResNet CNN for pest detection + ConvLSTM for temporal forecasting
  • Web Dashboard: React + Leaflet for interactive visualization

🏗️ System Architecture

┌─────────────────┐    ┌──────────────────┐    ┌─────────────────┐
│   Data Sources  │    │   ML Pipeline    │    │   Dashboard     │
├─────────────────┤    ├──────────────────┤    ├─────────────────┤
│ • Sentinel-2    │───▶│ • ResNet CNN     │───▶│ • React Frontend│
│ • Open-Meteo    │    │ • ConvLSTM       │    │ • Leaflet Maps  │
│ • Drone Images  │    │ • Data Fusion    │    │ • FastAPI       │
└─────────────────┘    └──────────────────┘    └─────────────────┘

🚀 Quick Start

Prerequisites

  • Python 3.9+
  • Node.js 16+
  • 8GB+ RAM recommended

1. Run Complete Pipeline

cd pest_forecaster
pip install -r requirements.txt
python run_complete_pipeline.py

2. Start Backend API

cd pest_forecaster
python backend/main.py

3. Start Frontend Dashboard

cd pest_forecaster/frontend
npm install
npm start

4. Access Dashboard

Open http://localhost:3000

📁 Project Structure

pest_forecaster/
├── backend/
│   ├── main.py                 # FastAPI server
│   ├── models/
│   │   ├── plant_disease_detector.py    # ResNet CNN
│   │   └── convlstm_forecaster.py       # ConvLSTM model
│   ├── utils/
│   │   ├── satellite_processor.py       # Sentinel-2 data
│   │   └── weather_processor.py         # Weather API
│   └── data/
│       ├── satellite/          # Satellite imagery
│       ├── weather/            # Weather forecasts  
│       ├── geotiff/           # Processed GeoTIFFs
│       └── models/            # Trained ML models
├── frontend/
│   ├── src/
│   │   ├── components/
│   │   │   ├── MapComponent.tsx        # Leaflet map
│   │   │   ├── FileUpload.tsx          # Drone image upload
│   │   │   ├── ForecastPanel.tsx       # Prediction display
│   │   │   └── StatusPanel.tsx         # System status
│   │   ├── App.tsx
│   │   └── index.tsx
│   └── package.json
└── requirements.txt

🔧 Phase-by-Phase Implementation

Phase 1: Data Ingestion & Processing

  • ✅ Sentinel-2 satellite data download via sentinelsat
  • ✅ NDVI calculation from NIR and Red bands
  • ✅ Weather forecast from Open-Meteo API
  • ✅ GeoTIFF creation for all data layers

Phase 2: Initial Pest Detection

  • ✅ ResNet-50 CNN for plant disease classification
  • ✅ Image patch processing for spatial analysis
  • ✅ Pest probability mapping from drone images
  • ✅ Integration with Kaggle Plant Disease dataset structure

Phase 3: Forecasting Model

  • ✅ ConvLSTM implementation for spatiotemporal prediction
  • ✅ Synthetic pest spread simulation for training
  • ✅ Multi-day forecast generation (1-3 days ahead)
  • ✅ Environmental factor integration

Phase 4: Visualization Dashboard

  • ✅ FastAPI backend with file upload endpoints
  • ✅ React + TypeScript frontend with Leaflet maps
  • ✅ Real-time heatmap visualization
  • ✅ Interactive forecast timeline

🤖 AI Models

ResNet Plant Disease Detector

  • Architecture: ResNet-50 with custom classification head
  • Input: 224x224 RGB drone image patches
  • Output: Binary classification (healthy vs. diseased)
  • Training: Transfer learning with plant disease dataset

ConvLSTM Pest Spread Forecaster

  • Architecture: Multi-layer ConvLSTM with attention
  • Input: Spatiotemporal data stack [pest, NDVI, temperature, wind]
  • Output: Future pest probability maps
  • Training: Synthetic pest spread simulations

📊 Features

🎯 Core Functionality

  • Upload drone images for pest detection
  • Generate 3-day pest spread forecasts
  • Interactive map with risk heatmaps
  • Download GeoTIFF results

📈 Analytics Dashboard

  • Real-time forecast metrics
  • Risk level indicators (Low/Medium/High)
  • Trend analysis and recommendations
  • System status monitoring

🌍 Data Integration

  • Satellite imagery (Sentinel-2)
  • Weather forecasts (Open-Meteo)
  • Drone image processing
  • Geospatial data fusion

🛠️ Technology Stack

Backend

  • FastAPI: REST API server
  • TensorFlow: Deep learning models
  • Rasterio: Geospatial data processing
  • OpenMeteo: Weather data API
  • Sentinelsat: Satellite data access

Frontend

  • React + TypeScript: UI framework
  • Leaflet: Interactive maps
  • Axios: API communication
  • CSS3: Custom styling

ML/Data Science

  • ResNet-50: Convolutional neural network
  • ConvLSTM: Spatiotemporal forecasting
  • NumPy/Pandas: Data manipulation
  • OpenCV: Image processing

📈 API Endpoints

POST /upload-drone-image     # Upload and process drone image
POST /generate-forecast      # Generate pest spread forecast  
GET  /forecast-data/{day}    # Get forecast data for visualization
GET  /download-geotiff/{file} # Download processed GeoTIFF
GET  /system-status          # Get system and model status

🎨 Screenshots

The dashboard provides:

  • Map View: Interactive pest risk heatmaps
  • Upload Panel: Drag-and-drop drone image upload
  • Forecast Panel: Multi-day predictions with metrics
  • Status Panel: System health and data sources

⚡ Performance

  • Model Accuracy: >95% on synthetic plant disease data
  • Forecast Horizon: 3 days with hourly resolution
  • Processing Time: <30 seconds per drone image
  • Map Rendering: Real-time visualization of 1000+ points

🔬 Scientific Foundation

Pest Spread Modeling

The ConvLSTM model simulates realistic pest dispersal based on:

  • Biological factors: Reproduction rates, natural mortality
  • Environmental factors: Temperature, wind, crop health (NDVI)
  • Spatial patterns: Neighboring pixel influence, field boundaries

Validation Approach

  • Synthetic data generation based on real pest behavior
  • Cross-validation on temporal sequences
  • Comparison with simple diffusion models

🚧 Future Enhancements

Data Sources

  • Real Kaggle Plant Disease dataset integration
  • Multiple satellite sensors (Landsat, MODIS)
  • Soil moisture and pH data
  • Historical pest outbreak records

Models

  • Ensemble methods for improved accuracy
  • Multi-pest species classification
  • Uncertainty quantification
  • Real-time model updates

Dashboard

  • Mobile app version
  • Multi-farm management
  • Historical trend analysis
  • Automated alert system

📄 License

This project is developed for educational and research purposes. Please ensure proper attribution when using components of this system.

🤝 Contributing

This implementation follows the complete specification from the provided PDF document for the Hyper-Local Pest Infestation Forecaster project.

📞 Support

For technical issues or questions about the implementation, please review the code comments and documentation within each module.

About

Forecasting agricultural pest spread with Sentinel-2 satellite data, weather APIs, and deep learning (ResNet + ConvLSTM), visualized through an interactive web dashboard.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages