FIRO is a lightweight, real-time wildfire detection system built for resource-constrained edge devices. A MobileNetV2 model โ optimized to TensorFlow Lite INT8 โ runs directly on a Raspberry Pi 5, classifying forest camera images and pushing fire alerts to a web dashboard and WhatsApp, all without relying on cloud compute.
BS Final Year Project ยท Department of Data Science ยท University of Kotli, AJK
Ahmed Ali ยท Seher Ishtiaq ยท Supervisor: Mr. Nabeel Ali ยท Session 2021โ2025
- Overview
- System Architecture
- Key Features
- Tech Stack
- Repository Structure
- Model Performance
- Getting Started
- Dashboard Pages
- Edge Device Pipeline
- Results
- Motivation
- Future Work
- Authors
Wildfires in Pakistan โ especially in Azad Jammu & Kashmir โ are increasingly devastating. In 2024 alone, 2,214 high-confidence VIIRS fire alerts were recorded across Pakistan. Traditional detection relies on satellite imagery (with 16-day revisit cycles), manual watchtowers, and public reporting โ all too slow for early intervention.
FIRO (Fire Intelligence & Response Observatory) solves this by putting AI directly on the ground:
- A USB camera mounted on a forest tower feeds images to a Raspberry Pi 5
- An INT8-quantized MobileNetV2 model runs fully on-device โ no cloud compute needed
- Only lightweight metadata (fire/no-fire label, confidence, GPS, timestamp) is sent to Firebase
- Alerts reach Forest Department staff via WhatsApp and a real-time web dashboard
97.5% accuracy ยท <1s inference latency ยท Runs on a $80 edge device
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ EDGE LAYER โ
โ โ
โ ๐ท USB Camera โ
โ โ RGB frames โ
โ โผ โ
โ ๐ฅ๏ธ Raspberry Pi 5 โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ 1. Capture image at timed intervals โ โ
โ โ 2. Resize to 224ร224 ยท Normalize pixels โ โ
โ โ 3. Run MobileNetV2 Lite (INT8 TFLite) โ โ
โ โ 4. Get: { label, confidence, timestamp, GPS } โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Metadata only (no raw images)
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ CLOUD LAYER (Firebase) โ
โ โ
โ ๐ฅ Firestore โ stores fire_logs collection โ
โ ๐ Firebase Auth โ secures dashboard access โ
โ ๐ก Triggers โ WhatsApp alerts on fire detection โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ DASHBOARD LAYER โ
โ โ
โ ๐ Web Dashboard (HTML/JS + Python Dash) โ
โ โโโ Live map with camera locations (Leaflet) โ
โ โโโ Real-time alert panel (auto-polls every 5 s) โ
โ โโโ Event log history (filterable) โ
โ โโโ Dark mode ยท PWA-enabled โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| Feature | Description |
|---|---|
| ๐ง On-Device Inference | MobileNetV2 Lite (INT8) runs entirely on Raspberry Pi โ no cloud compute |
| โก Real-Time Detection | Images captured and classified continuously; results pushed in seconds |
| ๐ก Minimal Bandwidth | Only compact metadata sent to Firebase โ no raw image uploads |
| ๐บ๏ธ Live Map Dashboard | Leaflet-powered interactive map shows all camera locations and fire status |
| ๐จ Instant Alerts | WhatsApp notifications delivered to forest staff on fire detection |
| ๐ Secure Login | Firebase Authentication guards dashboard access |
| ๐ Event Log History | Full searchable log of all detection events with timestamps |
| ๐ Dark / Light Mode | Full theme support across all dashboard pages |
| ๐ฑ PWA Ready | Installable as a mobile app via service worker + manifest |
| ๐ Python Dash View | Alternative Plotly/Dash analytics panel (app.py) for deeper analysis |
| Component | Technology |
|---|---|
| Language | Python 3.11 |
| ML Framework | TensorFlow Lite (INT8) |
| Model | MobileNetV2 (fine-tuned, quantized) |
| Camera | USB Camera (OpenCV capture) |
| Cloud Push | Firebase Admin SDK |
| Component | Technology |
|---|---|
| Frontend | HTML5, Tailwind CSS, Vanilla JS |
| Maps | Leaflet.js |
| Auth | Firebase Authentication |
| Database | Cloud Firestore |
| Icons | Font Awesome 6 |
| PWA | Service Worker + Web App Manifest |
| Analytics Panel | Python Dash + Plotly |
| Component | Technology |
|---|---|
| Database | Firebase Firestore |
| Authentication | Firebase Auth (Email/Password) |
| Alerts | WhatsApp (via Firebase trigger) |
| Hosting | Firebase Hosting (recommended) |
FIRO-FYP/
โ
โโโ ๐ dashboard/ # Web dashboard frontend + Dash backend
โ โโโ index.html # Main monitoring dashboard (live map, alerts)
โ โโโ login.html # Firebase Auth login/signup page
โ โโโ logs.html # Historical fire event log page
โ โโโ settings.html # User preferences (theme toggle)
โ โโโ login.css # Login page styles
โ โโโ login.js # Legacy login helper (superseded by login.html)
โ โโโ script.js # Firebase initialization script
โ โโโ service-worker.js # PWA offline caching
โ โโโ manifest.json # PWA web app manifest
โ โโโ logo.png # FIRO / university logo
โ โโโ app.py # Python Dash analytics dashboard
โ โโโ service_account_key.json # โ ๏ธ SECRET โ never commit (in .gitignore)
โ
โโโ ๐ Models Source Files/ # Trained & optimized ML model
โ โโโ mobilenetv2_fire_detection.tflite # INT8 quantized TFLite model
โ
โโโ ๐ raspberry-pi/ # Edge device inference code
โ โโโ capture.py # Camera capture + inference loop
โ โโโ firebase_push.py # Push results to Firestore
โ โโโ requirements.txt # Pi dependencies
โ
โโโ .gitignore # Ignores secrets, venvs, IDE files
โโโ README.md # You are here
Note: The
raspberry-pi/folder contains the on-device code that runs the inference loop on Raspberry Pi 5. Both codebases share the same Firebase project.
| Model | Parameters | Test Accuracy |
|---|---|---|
| MobileNetV2 (Proposed) | 2.6 M | 97.50% โ |
| VGG-16 | 15.24 M | 93.23% |
| ResNet-50 | ~25 M | 96.59% |
| EfficientNet-B0 | 4.38 M | 98.47% |
| EfficientNetV2-B0 | 6.25 M | 97.58% |
| YOLOv11 Nano | 1.53 M | 96.40% |
MobileNetV2 was chosen despite not being the highest-accuracy model โ its 2.6M parameter count, TFLite compatibility, and INT8 quantization make it the only realistic choice for real-time inference on Raspberry Pi 5.
| Metric | MobileNetV2 (FP32) | MobileNetV2 Lite (INT8) |
|---|---|---|
| Accuracy | 0.96 | 0.95 |
| Precision | 0.96 | 0.95 |
| Recall | 0.96 | 0.95 |
| F1-Score | 0.96 | 0.95 |
- Total images: 6,247 (Fire: 2,821 ยท No Fire: 3,427)
- Train / Val / Test: 4,350 / 656 / 1,241
- Image size: 224 ร 224 RGB
- Source: Kaggle forest fire dataset
12 images captured in actual forest fires near Khuiratta and Nakyal, AJK (Dec 2025 โ Jan 2026) โ 100% detection accuracy under low-light, real-world conditions.
- Python 3.10 or 3.11
- A Firebase project (create one free)
- Raspberry Pi 5 with Raspberry Pi OS (64-bit)
- USB camera
- Git
Clone the repo:
git clone https://github.com/datixai/FIRO-FYP.git
cd FIRO-FYPInstall Python dependencies (for app.py Dash dashboard):
cd dashboard
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install dash plotly pandas google-cloud-firestoreSet your Firebase credentials:
export GCP_KEY_PATH=/path/to/your/service_account_key.jsonRun the Dash analytics dashboard:
python app.py
# Open http://127.0.0.1:8050For the HTML dashboard (index.html, login.html, etc.) โ simply open in a browser or deploy to Firebase Hosting:
npm install -g firebase-tools
firebase login
firebase init hosting
firebase deploy# On Raspberry Pi 5 (SSH in or open terminal)
git clone https://github.com/datixai/FIRO-FYP.git
cd FIRO-FYP/raspberry-pi
python -m venv venv
source venv/bin/activate
pip install -r requirements.txtPlace your Firebase service account key (from Firebase Console โ Project Settings โ Service Accounts):
# Copy the JSON key to the raspberry-pi directory (this file is gitignored)
cp /path/to/service_account_key.json ./service_account_key.jsonRun the detection loop:
python capture.pyThe script will:
- Capture an image via the USB camera every N seconds
- Resize and normalize to 224ร224
- Run inference using
mobilenetv2_fire_detection.tflite - Push results to Firebase Firestore
- Trigger WhatsApp alert if fire is detected
- Go to Firebase Console โ your project
- Enable Firestore Database โ start in production mode
- Enable Authentication โ Email/Password provider
- Create your Firestore collection:
fire_logs - Download Service Account Key (Project Settings โ Service Accounts โ Generate New Private Key)
โ ๏ธ Never commit this file โ it is listed in.gitignore
Firestore document structure (written by Raspberry Pi):
{
"timestamp_ms": 1704067200000,
"timestamp_str": "2026-01-01 12:00:00",
"detection_class": "Fire",
"fire_probability": 0.94,
"camera_location": "Khuiratta Tower 1",
"coords_x": 33.6844,
"coords_y": 73.0479,
"device_id": "rpi5-unit-01"
}Firebase-authenticated login/signup. Session expires on browser close (session persistence).
File: dashboard/login.html
- Live Leaflet map โ colour-coded markers (๐ด Fire / ๐ข Safe) at each camera location
- Alert panel โ pulses red with critical fire alert details when fire is detected
- Stats cards โ total alerts, active cameras, latest detection time
- Real-time updates โ auto-polls Firebase every 5 seconds
- Dark / Light mode toggle
- Full history of all detection events from Firebase
- Filter by: Fire / No Fire / All
- Each entry shows: timestamp, location, confidence score, classification
- Dark mode supported
- Theme preference (Light / Dark)
- More options in development (alert thresholds, notification recipients)
- Alternative analytics view using Plotly/Dash
- Scatter mapbox with fire probability bubble sizing
- Recent log table with conditional red highlighting for fire events
- Last-hour data window with 5-second polling
USB Camera
โ
โ RGB frame
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Preprocessing โ
โ โข Resize โ 224 ร 224 โ
โ โข Normalize pixel values [0, 1] โ
โ โข Format as float32 tensor โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TFLite Interpreter โ
โ mobilenetv2_fire_detection.tflite โ
โ (INT8 quantized, ~2.6M params) โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Postprocessing โ
โ โข Softmax probabilities โ
โ โข Threshold: 0.70 โ Fire โ
โ โข Add GPS, device ID, timestamp โ
โโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโ
โ
โโโโโโโโดโโโโโโโ
โ โ
โผ โผ
Firebase WhatsApp
Firestore Alert
(metadata) (if fire)
Training Setup:
- Framework: TensorFlow 2.x + Keras
- Hardware: NVIDIA Tesla P100 GPU
- Transfer learning: ImageNet pre-trained weights โ fine-tuned on wildfire dataset
- Quantization: Post-training INT8 via TFLite Converter + calibration dataset
- โ 97.5% test accuracy (MobileNetV2 FP32)
- โ 95% accuracy after INT8 quantization (negligible drop)
- โ 100% accuracy on 12 real night-time wildfire images from AJK
- โ Sub-second inference on Raspberry Pi 5
- โ All 6 unit test cases passed (capture โ preprocess โ infer โ push โ alert โ display)
Pakistan recorded 966 high-confidence fire alerts in 2025 and 1,905 in 2024 โ the highest ever recorded. The December 2025 Neelum Valley fire and recurring fires in Sherani, Margalla Hills, and Gilgit-Baltistan illustrate the urgent need for early warning systems. Satellite-based tools have 16-day revisit cycles. Manual watchtowers don't scale.
FIRO is designed for exactly this gap: affordable, deployable, and accurate โ built for the forest conditions of Northern Pakistan and Azad Kashmir.
- Multi-sensor fusion (temperature, humidity, gas sensors)
- Drone-based aerial image integration
- SMS / mobile push notifications in addition to WhatsApp
- Temporal modeling for smoke trajectory prediction
- Federated learning across multiple edge nodes
- Large-scale long-term field deployment and validation
- Admin panel for managing camera nodes and alert thresholds
| Name | Role | Contact |
|---|---|---|
| Ahmed Ali | Group Leader | rajaahmedalikhan97@gmail.com |
| Seher Ishtiaq | Member | hania93malik@gmail.com |
Supervisor: Mr. Nabeel Ali
Institution: Department of Data Science, Faculty of Computing & Engineering
University of Kotli, Azad Jammu & Kashmir
This project is released under the MIT License.
Built with โค๏ธ for the forests of Azad Kashmir.