A complete wildfire detection and monitoring system using YOLOv8 deep learning and Sentinel-2 satellite imagery. The system detects active fire zones, classifies burn severity, maps total damage area, and monitors ongoing wildfire events.
- Python 3.13
- A free Copernicus Data Space Ecosystem account (required to download Sentinel-2 imagery)
# Clone the repository
git clone <repo-url>
cd wildfire-detection-and-monitoring
# Create and activate a virtual environment (recommended)
python3 -m venv wildfire_env
source wildfire_env/bin/activate
# Install dependencies
pip install -r requirements.txtstreamlit run wildfire_app.pyOpen your browser at http://localhost:8501
jupyter notebook| Notebook | Purpose |
|---|---|
index.ipynb |
Main analysis — downloads Sentinel-2 data, computes NBR/NDVI, trains YOLO |
wildfire_notebook2.ipynb |
Extended pipeline — multi-region validation and YOLO v2 retraining |
wildfire_notebook_final.ipynb |
Final summary with all outputs and visualisations |
# Run wildfire detection on a satellite image
python wildfire_detection.py
# Run the automatic monitoring system
python wildfire_monitor.py
# Retrain the v3 model from scratch
python retrain_v3.pywildfire-detection-and-monitoring/
├── wildfire_app.py # Streamlit web application
├── wildfire_detection.py # Standalone detection script
├── wildfire_monitor.py # Automatic monitoring script
├── retrain_v3.py # Multi-region v3 retraining script
├── index.ipynb # Main analysis notebook
├── wildfire_notebook2.ipynb # Extended pipeline notebook
├── wildfire_notebook_final.ipynb# Final results notebook
├── requirements.txt # Python dependencies
├── monitor_config.json # Monitoring configuration
├── monitor_regions.json # Regions being monitored
├── monitoring_log.csv # Monitoring event log
├── yolov8n.pt # Base YOLOv8 nano weights
├── yolov8s.pt # Base YOLOv8 small weights
├── runs/detect/
│ ├── wildfire_severity_v2/ # v2 weights + results
│ ├── wildfire_severity_v3/ # v3 weights + results
│ └── wildfire_severity_v4_balanced/ # v4 balanced weights + results (NEW)
├── yolo_dataset/ # Rhodes training tiles
├── yolo_dataset_v3/ # Multi-region training tiles
├── yolo_dataset_v4_balanced/ # v3 + Extreme-class oversampling (NEW)
└── monitoring_maps/ # Saved monitoring outputs
Sentinel-2 Satellite Data (Copernicus)
|
+---------+---------+
| |
YOLO Detection NBR Analysis
| |
Fire Zones + Pixel-level
Severity Class Fire Map
| |
+---------+---------+
|
Burn Severity Map
|
NDVI Vegetation Loss
|
Final Damage Report
- Fine-tuned YOLOv8 model trained on our own satellite data
- Uses transfer learning from NBR labels — no manual labelling needed
- Splits satellite image into 640×640 pixel tiles (6.4 km × 6.4 km each)
- Detects fire zones AND classifies severity in one single pass
- Outputs colour-coded bounding boxes with confidence scores
- Two versions available — see YOLO Models section below
- Uses Near-Infrared (B08) and SWIR (B12) Sentinel-2 bands
- NBR = (B08 - B12) / (B08 + B12)
- dNBR = pre-fire NBR − post-fire NBR
- Classifies every pixel into a burn severity class
- Maps burned area pixel by pixel across the entire scene
- 62 km² of active fire detected on Rhodes
The app includes two trained models. You can switch between them live from the sidebar in the web app — no code changes needed.
| Detail | Value |
|---|---|
| Architecture | YOLOv8 nano |
| Trained on | Rhodes, Greece 2023 |
| Training tiles | 476 |
| Epochs | 41 |
| Precision | 93.0% |
| Recall | 88.1% |
| mAP50 | 94.1% |
| mAP50-95 | 80.9% |
Strengths: High accuracy on Rhodes data, fast and lightweight
Weakness: Only learned from one fire — may struggle on unseen regions
| Detail | Value |
|---|---|
| Architecture | YOLOv8 small (4× more powerful than nano) |
| Trained on | Rhodes + Evros (Greece) + Tenerife (Spain) 2023 |
| Training tiles | 450+ across 3 regions |
| Epochs | 80 |
| Precision | 76.6% |
| Recall | 86.5% |
| mAP50 | 84.9% |
| mAP50-95 | 71.5% |
Strengths: Generalises across multiple countries and landscapes
Weakness: Lower headline score but more honest — tested on regions it hasn't fully seen before
Per-class breakdown (v3):
| Class | Precision | Recall | mAP50 |
|---|---|---|---|
| Unburned | 92.0% | 100% | 99.3% |
| Low Severity | 85.0% | 98.0% | 96.8% |
| Moderate Severity | 87.6% | 87.0% | 92.1% |
| High Severity | 72.6% | 73.3% | 71.4% |
| Extreme Severity | 45.5% | 50.0% | 48.4% |
The v3 per-class breakdown above made the problem clear: the Extreme severity class was at 48.4% mAP50 — half the performance of Unburned. Cause: extreme burns are rare events even inside wildfires, so the model saw too few Extreme tiles during training.
v4_balanced solves this with class-aware oversampling (no architecture change). Every train tile containing at least one Extreme label is duplicated 4× before training. YOLO's per-epoch augmentation (flipud, fliplr, rotation, HSV jitter) means each duplicate is augmented differently during training, so the model sees the rare class with genuine variety instead of identical copies.
| Detail | Value |
|---|---|
| Architecture | YOLOv8 small (same as v3) |
| Source data | v3 multi-region dataset |
| Training tiles | 742 (was 398 — 344 duplicate Extreme tiles) |
| Epochs | 80 |
| Precision (overall) | 85.5% |
| Recall (overall) | 89.2% |
| mAP50 | 93.5% |
| mAP50-95 | 84.1% |
Per-class breakdown (v4_balanced):
| Class | Precision | Recall | mAP50 | Δ vs v3 |
|---|---|---|---|---|
| Unburned | 98.1% | 100% | 99.5% | +0.2 pp |
| Low Severity | 92.2% | 95.0% | 96.9% | +0.1 pp |
| Moderate Severity | 90.4% | 87.6% | 96.0% | +3.9 pp |
| High Severity | 83.0% | 81.5% | 86.8% | +15.4 pp |
| Extreme Severity | 63.6% | 81.8% | 88.1% | +39.7 pp |
The Extreme class jumped from 48.4% to 88.1% mAP50 — a 40-point lift from a data-side intervention with no model architecture change. The High class also gained 15 points as collateral benefit (Extreme tiles often contain High labels).
How to reproduce:
python3 train_v4_balanced.py # build the balanced dataset
python3 train_v4_balanced.py --train # build + train (~5 hours on CPU, ~30 min on GPU)| Feature | v2 | v3 | v4_balanced |
|---|---|---|---|
| Architecture | YOLOv8 nano | YOLOv8 small | YOLOv8 small |
| Regions trained on | 1 (Rhodes) | 3 | 3 |
| Training tiles | 476 | 450+ | 742 |
| mAP50 | 94.1% | 84.9% | 93.5% |
| Extreme mAP50 | (not measured) | 48.4% | 88.1% |
| Best for | Known regions | Unseen / new regions | Best Extreme-class detection |
| Model size | 6.3 MB | 22.5 MB | 22.5 MB |
⚠️ Honest caveat on v4_balanced: evaluation used the val set inherited from v3, which uses tile-index splits with some geographic adjacency to training tiles. The +40 pp Extreme-class lift is real (same val set, only training changed). The absolute 88.1% may be a few points lower on truly unseen regions — the underlying model still benefits from the class-balanced training regardless.
Open the app and look at the sidebar on the left. Under Model Version select v2, v3, or v4_balanced. The app reloads instantly with the chosen model — no code editing required.
| Step | Action | Result |
|---|---|---|
| 1 | Download Sentinel-2 post-fire image | 6712×5464 pixel image |
| 2 | Generate NBR severity labels | 5 class labels per pixel |
| 3 | Split into 640×640 tiles | 80 base tiles |
| 4 | Augment burned class tiles | 476 training tiles total |
| 5 | Fine-tune YOLOv8 | 41 epochs (v2) / 80 epochs (v3) |
| 6 | Evaluate performance | 94.1% mAP (v2) / 84.9% mAP (v3) |
| Class | Label | dNBR Range | Colour |
|---|---|---|---|
| 0 | Unburned | < 0.1 | Green |
| 1 | Low Severity | 0.10 – 0.27 | Yellow |
| 2 | Moderate Severity | 0.27 – 0.44 | Orange |
| 3 | High Severity | 0.44 – 0.66 | Red |
| 4 | Extreme Severity | > 0.66 | Black |
| Wildfire | YOLO Zones | mAP50 | NBR Burned | Official | Accuracy |
|---|---|---|---|---|---|
| Rhodes, Greece | 219 zones | 94.1% | 801 km² | ~750–800 km² | Excellent |
| Evros, Greece | 101 zones | 94.1% | 1,987 km² | ~2,000 km² | Excellent |
| Tenerife, Spain | 10 zones | 94.1% | 719 km² | ~700 km² | Excellent |
mAP50 is the same across all regions because it reflects the model's overall training score, not a per-region test. v2 was only trained on Rhodes so performance on Evros and Tenerife is not fully reliable.
| Wildfire | YOLO Zones | Avg Confidence | Max Confidence | NBR Burned | Official | Accuracy |
|---|---|---|---|---|---|---|
| Rhodes, Greece | 260 zones | 77% | 100% | 801 km² | ~750–800 km² | Excellent |
| Evros, Greece | 425 zones | 86% | 100% | 1,987 km² | ~2,000 km² | Excellent |
| Tenerife, Spain | 255 zones | 81% | 99% | 719 km² | ~700 km² | Excellent |
v3 was trained on all 3 regions. Confidence scores are significantly higher and more fire zones are detected because the model has learned from each of these landscapes directly.
| Feature | YOLO | NBR |
|---|---|---|
| Type | Deep Learning AI | Physics Formula |
| Output | Bounding boxes + severity | Pixel-level map |
| Accuracy | 94.1% mAP (v2) | Within 2–5% of official |
| Training | Fine-tuned on NBR labels | No training needed |
| Best for | Real-time camera/drone | Satellite imagery |
- Compares pre and post fire images using NASA/USGS thresholds
- Five severity classes mapped pixel by pixel
- Total burned area calculated in km²
- Pre and post fire NDVI comparison
- Quantifies total vegetation loss
- Average NDVI loss: 0.114 across burned zones on Rhodes
This project has been audited for data leakage. Disclosing what was found is the fair thing to do, and what most portfolio projects skip.
The reported YOLO mAP50 numbers (94.1% for v2, 84.9% for v3) come from validation tiles that share scenes — and therefore fire dynamics, vegetation, and weather — with the training tiles. Adjacent satellite tiles are spatially correlated, which inflates measured accuracy.
Realistic expectation on a brand-new fire region the model has never seen: roughly 65–80% mAP50.
The current retrain_v3.py has been updated with a leakage-safe spatial-block
split: per region, the rightmost 20% column of x-tiles is reserved for
validation, ensuring train and val tiles are not spatially adjacent. This
applies to Evros and Tenerife from now on. Rhodes preserves the inherited
v2 split for backwards compatibility — to retrain Rhodes with the same
spatial-block discipline, regenerate the tiles from the source TIFs through
tile_and_label().
The reported burned-area km² figures (Rhodes 801 km², Evros 1,987 km², Tenerife 719 km²) come from the NBR spectral index — a deterministic formula applied per pixel, not a learned model. These numbers are independent of train/val splitting and remain defensible. The "matches official ESA estimates within 2–5%" claim refers to NBR output, not YOLO.
- ✅ Spatial-block train/val split for new regions (Evros, Tenerife)
- ✅ NBR pipeline is split-independent (deterministic formula)
⚠️ Rhodes tiles inherit the v2 random-index split; users wanting fully consistent splitting should regenerate Rhodes from its source TIF⚠️ For "true unseen-region" performance estimates, leave-one-region-out cross-validation (train on 2 regions, test on the 3rd) is the gold standard and not yet included
Most portfolio ML projects skip the deployment-ethics question. This section is here because the alternative — silence — becomes a liability the moment the model is taken seriously.
This is research and educational code, not a certified emergency-response system. The model is validated on three Mediterranean wildfire events from summer 2023.
Predictions should not be used as the sole basis for evacuation, firefighting deployment, or insurance-claim decisions. For real-world use, pair the output with official sources:
- Copernicus Emergency Management Service
- NASA FIRMS Active Fire Data
- Your national fire authority (e.g. CAL FIRE, UK Fire & Rescue Service, Hellenic Fire Service, etc.)
Under the EU AI Act (Article 73, fully applicable from August 2026), AI systems contributing to environmental harm may trigger serious-incident reporting obligations. Operators deploying this kind of model in a high-risk context should account for that.
Training data covers only Northern Mediterranean conifer / mixed forest ecosystems (Rhodes, Evros, Tenerife — all summer 2023).
The model has not been evaluated on:
- Tropical / equatorial fires (Congo Basin, Amazon, Southeast Asia)
- Boreal forest fires (Siberia, Northern Canada)
- Eucalyptus and Australian bushland
- Arid grassland fires (Sahel, Outback)
Africa accounts for roughly 70% of global burned area annually but is not represented in the training set. Expect significantly degraded performance outside the training distribution.
v3 added multi-region training (3 Mediterranean regions) to mitigate single-region bias — closing the broader gap to the Global South remains a known open task and the largest fairness issue in this project.
Sentinel-2 imagery (10 m / pixel) is too coarse to identify individuals but does reveal buildings, roads, and vehicles. This pipeline does not currently apply automatic property masking.
For deployment over populated areas, integrate a building mask before publishing inference outputs — e.g.:
- OpenStreetMap building footprints
- Microsoft Building Footprints (global)
- Local cadastre or land-use registry data
The EU AI Act (in effect from August 2026) and GDPR apply transparency obligations even to environmental sensing systems that incidentally capture private property.
This project deploys no ground sensors, so no physical infrastructure on tribal land is involved. However, the model's outputs can affect indigenous and First Nations communities when applied over their territories — e.g. the Amazon, Northern Canadian Inuit lands, or Aboriginal Australia.
Users monitoring such regions should apply Free, Prior and Informed Consent (FPIC) — recognised under UN Declaration on the Rights of Indigenous Peoples (UNDRIP) Article 31 — before publishing burned-area assessments or alerts that could affect those communities' interests or land-management decisions.
| File | Description |
|---|---|
yolo_severity_detection.png |
YOLO detection + severity map |
yolo_vs_nbr_comparison.png |
Side-by-side method comparison |
fire_detection_map.png |
NBR binary fire map |
wildfire_classification_map.png |
Burn severity map |
ndvi_analysis.png |
Vegetation loss map |
complete_system.png |
Full linked system output |
| Library | Purpose |
|---|---|
ultralytics |
YOLOv8 deep learning model |
openeo |
Copernicus Data Space connection |
rasterio |
Satellite image processing |
numpy |
Numerical computation |
matplotlib |
Visualisation |
opencv-python |
Image tile processing |
geopandas |
Geospatial data handling |
streamlit |
Web application interface |
European Space Agency — Copernicus Data Space Ecosystem https://dataspace.copernicus.eu
MIT Licence — free to use, modify, and distribute with attribution.