MedFire Watch: wildfire and smoke detection with YOLOv8, NASA satellite hotspots, a fire-weather danger map and Telegram alerts.
| Live prediction | Earth zoom and 3D city |
|---|---|
![]() |
![]() |
- Explore a MapLibre globe with NASA heat observations, official fire-weather danger and place forecasts.
- Detect fire and smoke from a browser camera and queue annotated Telegram photos after persistent detections.
- Inspect images and play original videos with aligned boxes, a detection timeline and seek prioritisation.
- Review photo delivery attempts and download full-resolution annotated video exports.
- Pause/resume or cancel video prediction; clear generated data from Storage & cleanup.
- Manage Telegram detection beside Delete all in Alerts; edit or reset the camera cooldown from Live camera.
Complete setup: installation, NASA key, Telegram and first run
Python 3.11 is strictly required (Python 3.12+ is not supported). Create the environment, install requirements, and launch services using its interpreter.
Windows PowerShell:
py -3.11 -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install --upgrade pip
pip install -r requirements.txt -c constraints-py311.txt
python scripts/run_app.pyLinux/macOS:
python3.11 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -r requirements.txt -c constraints-py311.txt
python scripts/run_app.pyBefore launching, copy .env.example to .env and supply your FIRMS key and Telegram bot token.
Follow the setup guide to detect your private chat. Open
localhost:8501. Image and video inference also works without these integration credentials.
Under Live camera, save a cooldown of 0–1440 minutes (0 disables the wait), or select Reset current wait to allow the next qualifying alert. The interval persists across restarts; resetting rearms detection persistence, invalidates queued old snapshots and keeps history. An already transmitted Telegram request cannot be recalled.
When MEDFIRE_API_TOKEN is set, native camera/video pages ask you to sign in once for an
eight-hour HttpOnly session. Use the same hostname for both services. Read
deployment boundaries before remote use: Streamlit requires its own access gateway.
| Variable | Default | Purpose |
|---|---|---|
FIRMS_MAP_KEY |
None | NASA FIRMS MAP_KEY for 24-hour satellite heat observations |
TELEGRAM_BOT_TOKEN |
None | Telegram bot token from BotFather |
TELEGRAM_CHAT_ID |
None | Telegram recipient chat ID for alert delivery |
MEDFIRE_API_TOKEN |
None | Protects sensitive reads and all writes; header token or browser session |
MEDFIRE_ALLOWED_HOSTS |
None | Extra allowed Host headers beyond localhost and loopback |
MEDFIRE_ALLOWED_ORIGINS |
None | Extra allowed origins for cross-origin mutation requests |
MEDFIRE_VIDEO_TTL_HOURS |
24 |
Hours to retain terminal video jobs (0–8760); weather cache retention is 24h |
MEDFIRE_MAX_VIDEO_JOBS |
2 |
Maximum reserved uploads/preparation/processing jobs (1–16) |
MEDFIRE_MAX_STORED_VIDEO_JOBS |
64 |
Maximum active and retained video jobs (1–4096) |
MEDFIRE_VIDEO_UPLOAD_TIMEOUT_SECONDS |
300 |
Upload body deadline (1–3600 seconds) |
MEDFIRE_MAX_CAMERA_SESSIONS |
64 |
Camera tracker limit (1–1024); idle timeout 5 minutes |
MEDFIRE_INCLUDE_LOW_CONFIDENCE |
0 |
Set to 1 to include low-confidence VIIRS satellite hotspots |
MEDFIRE_SKIP_WARMUP |
0 |
Set to 1 to bypass heavy YOLO inference warmup during launch/tests |
| Measurement | Result |
|---|---|
| D-Fire official test mAP50 | 0.747 on 4,306 images |
| Test precision / recall | 0.740 / 0.681 |
| GPU-scaled video analysis, batch 8 | 205.81 fps on an NVIDIA RTX 4060 |
| 1080p60 annotated export | 44.209 processing fps, 1,645 input and output frames |
Sources: split metrics, benchmark conditions, model card.
| Precision–Recall Curve | Confusion Matrix |
|---|---|
![]() |
![]() |
| Official D-Fire test precision–recall curve | Official D-Fire test confusion matrix |
| Fire Danger Map | Image Inspector |
|---|---|
![]() |
![]() |
| Copernicus GWIS fire danger categories mapped in MapLibre GL | Single-frame inspection with bounding boxes and confidence scores |
| Live Camera Alert |
|---|
![]() |
| Live browser camera monitoring with IoU persistence filtering |
For the complete interface gallery, video studio views, map credits, and Telegram delivery proof, see Interface Screenshots.
flowchart LR
Providers[NASA / Copernicus / Open-Meteo] --> API[FastAPI and caches]
API --> Map[MapLibre globe]
Map --> UI[Streamlit]
Media[Camera / images / video] --> YOLO[YOLOv8s]
YOLO --> Boxes[Overlay and video export]
Boxes --> UI
YOLO --> Rules[Persistence and IoU]
Rules --> Telegram[Queued Telegram photos]
Architecture explains caching, frame lookup and hardware fallbacks. Training and evaluation documents dataset preparation and held-out testing.
- Satellite observations may be late, cloud-obscured or industrial heat; markers are not confirmed incidents.
- Weather danger is not ignition probability; zoom does not improve forecast resolution and EOX imagery is dated.
- Camera detections can miss fire or produce false alarms; held-out alerts per camera-hour are unmeasured.
- Hardware, browser and network conditions affect latency, compatibility and delivery; VFR export support is incomplete.
- This research application supports human investigation and requires emergency-service verification.
Detailed limits and model protocol
Headless multi-camera monitoring; held-out false-alarm and time-to-alert evaluation; further deployment hardening. Optional API token checks are already implemented; see deployment limitations for browser login and deployment boundaries.
Use Node.js 22 for browser development checks. Install development dependencies and verify the test suite:
pip install -r requirements-dev.txt -c constraints-py311.txt
npm ci
# Quality gates (all must pass)
ruff check .
pytest -q
npm test
npm run format:check
python scripts/check_docs.pySet MEDFIRE_SKIP_WARMUP=1 to run tests without loading model weights into memory.
See Contributing Guide for code style guidelines and Changelog for version history.
The project audit records verification results and outstanding dependency/deployment findings.
Python 3.11, FastAPI, Streamlit, Ultralytics YOLOv8, PyTorch, OpenCV, FFmpeg, MapLibre GL JS, NumPy, pandas, pytest and Node.js tests.
| Directory | Purpose |
|---|---|
api/, dashboard/ |
API and browser interface |
medfire_watch/, alerts/ |
Detection, map services and Telegram delivery |
models/detection/weights/ |
Deployed checkpoint |
scripts/, configs/ |
Launch, refresh, training and configuration |
tests/, docs/ |
Checks, results and documentation |
Code is released under the AGPL-3.0 License, copyright Jasser Zormati. Provider and dataset terms apply separately; see Third-Party Notices and Data Sources.






