Skip to content

A Flask-based web application leveraging Deep Learning (CNNs) to predict and detect wildfires using satellite imagery, camera feeds, and real-time meteorological data.

License

Notifications You must be signed in to change notification settings

NoumanZahid-85/Wildfire-Detection-System

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🌲πŸ”₯ WildfireGuard

Saving Forests with Orbital Intelligence & Deep Learning

Home Dashboard

Python

TensorFlow

Flask

License

WildfireGuard is a state-of-the-art early detection system that focus Computer Vision and Meteorological Data to predict wildfire risks in real-time. Whether it's analyzing a live camera feed or scanning satellite tiles from space, WildfireGuard acts as an AI-powered sentinel for our forests.


🧠 The AI Core: Multi-Modal Detection

This isn't just a website; it's a decision support system powered by an ensemble of neural networks. We combine visual evidence with atmospheric conditions to reduce false positives and increase detection confidence.

1. The "Eyes": Convolutional Neural Networks (CNN)

We deploy Transfer Learning using the powerful ResNet50V2 architecture.

  • Backbone: ResNet50V2 pre-trained on ImageNet (frozen layers to retain feature extraction capabilities).
  • Custom Head: Dense top layers trained specifically on our Wildfire vs. No-Wildfire dataset.
  • Input Pipeline: Images are resized to 224x224, normalized to [0,1], and augmented (rotation, zoom, flips) to ensure model robustness against different angles and lighting conditions.
  • Satellite Model: Trained on overhead orbital imagery to spot smoke plumes and thermal anomalies.
  • Camera Model: Trained on ground-level footage to detect immediate flame outbreaks.

2. The "Atmosphere": Meteorological Classifier

Fire doesn't happen in a vacuum. We analyze the environment using a dedicated Dense Neural Network.

  • Data Source: Real-time fetch via Open-Meteo API.
  • Features: Temperature, Humidity, Wind Speed, Rain, and calculated FWI (Fire Weather Indices: FFMC, DMC, DC, ISI, BUI).
  • Preprocessing: StandardScaler (std_scaler_weather.pkl) ensures inputs match the training distribution.

3. The "Fusion": Ensemble Logic

The system doesn't rely on a single source of truth. It calculates a Weighted Risk Score:

$$ \text{Risk} = \frac{(\text{Satellite Probability} + \text{Weather Risk Score})}{2} $$

If the combined confidence crosses the threshold (>50%), the system triggers a Wildfire Alert.


πŸš€ Features & Architecture

Dashboard Analysis

  • πŸ›°οΈ Orbital Scan: Interactive Leaflet maps allow users to drop pins anywhere on Earth. The backend grabs the satellite tile, crops it, and feeds it to the CNN.
  • πŸ“· Vision Analysis: Upload local drone or CCTV footage for instant binary classification.
  • ☁️ Live Weather Scoring: Automatically pulls weather data for the selected geolocation to validate visual predictions.
  • πŸ”” Subscription System: Users can subscribe to specific coordinates. (Alerts stored in SQLite alerts.db).
  • 🎨 Modern UI: Built with Tailwind CSS and Glassmorphism design principles for a sleek, dark-mode experience.

πŸ› οΈ Tech Stack

Component Technology Description
ML Engine TensorFlow / Keras ResNet50V2 & Dense Networks
Backend Flask (Python) REST API & Model Serving
Frontend Tailwind CSS + HTML5 Responsive, modern styling
Mapping Leaflet.js Open-source interactive maps
Search Nominatim API Geocoding & Location search
Weather Open-Meteo Real-time meteorological data

⚑ Getting Started

1. Prerequisites

Ensure you have Python 3.9+ and pip installed. A GPU is recommended for training, but the pre-trained models run fine on CPU for inference.

2. Installation

# Clone the repo
git clone https://github.com/yourusername/Wildfire-Detection-System.git
cd Wildfire-Detection-System

# Create virtual environment
python -m venv venv
# Windows:
venv\Scripts\activate
# Mac/Linux:
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

3. Model Setup

Note: The trained model files are too large for GitHub. You can download them from this Google Drive link: Click.

Place the downloaded models in the analysis/ directory. The system looks for:

  • wildfire_detection_model.keras (Camera)
  • wildfire_satellite_detection_model.keras (Satellite)
  • meteorological-detection-classification.keras (Weather)
  • std_scaler_weather.pkl (Weather Scaler)

(Note: If models are missing, the system gracefully degrades to a default 50% probability to keep the UI functional for demos.)

4. Ignite the Engine πŸ”₯

python src/app.py

Navigate to http://127.0.0.1:5000 and start detecting.


πŸ“‘ API Reference

The backend exposes simple REST endpoints for integration:

Method Endpoint Payload Response
POST /satellite_predict {"location": [lng, lat], "zoom": 15} JSON with Satellite, Weather, and Average probabilities.
POST /camera_predict FormData (image file) {"wildfire_prediction": 0/1, "confidence": %}
POST /alert {"email": "...", "lat": ..., "lng": ...} Success message (stored in DB).

πŸ“ Notes & Limitations

  • Map Tiles: We use OpenStreetMap (OSM) via Leaflet. It is free but rate-limited.
  • Email Alerts: The scheduler code for sending emails is currently commented out for safety/demo purposes. Subscriptions are saved to alerts.db.
  • Data Privacy: Uploaded images are processed in memory or temporarily saved for inference and immediately discarded.

Built with ❀️ for a greener, safer planet.

About

A Flask-based web application leveraging Deep Learning (CNNs) to predict and detect wildfires using satellite imagery, camera feeds, and real-time meteorological data.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages