Inspiration
A wildfire is decided in its first hour. During the smoldering phase — the 1–2 hours before open flame — it is still a bucket-of-water problem. But that phase is invisible to cameras and satellites, and the forests at risk have no internet, no power grid, and no room for a GPU. Field-proven companies like Dryad Networks have shown that gas/PM2.5 sensors with on-device AI can catch fires at this stage. We asked: can a hackathon team build that entire brain — the neural network, the training, the anomaly detection, the alert logic — from scratch, in pure C++, small enough to live on the sensor itself? EMBER is the answer.
Problem Statement
Ultra-early wildfire detection in places with zero connectivity and zero infrastructure, where cloud APIs and Python runtimes are physically not an option — plus the unglamorous twin problem that kills real deployments: telling a dying sensor apart from a dying forest.
Solution Overview
EMBER is a complete on-device ML engine in pure C++17 with zero external dependencies. Every 5 minutes a node reads 6 channels (temperature, humidity, PM2.5, CO, IR flux, wind). A rolling 1-hour window becomes 22 physical features — levels, trends, volatility, vapour pressure deficit, smoke build-up, and sensor-health indicators. Two models vote on every window:
- A 4-class MLP classifier (22-96-48-4, softmax) → NOMINAL / SMOLDERING / ACTIVE FIRE / SENSOR FAULT
- An autoencoder (22-16-4-16-22) trained only on nominal data → an open-set anomaly score that flags events the classifier was never taught
A 2-consecutive-hit hysteresis suppresses false alarms. A frozen PM2.5 sensor pages a technician — it does not scramble a helicopter.
Key Features
- Neural network, backpropagation, Adam optimizer, softmax/cross-entropy and MSE losses — all implemented from scratch in this repo (~1,700 lines, 7 files)
- Physics-inspired simulator (diurnal cycles, Ornstein–Uhlenbeck wind, exponential combustion ramps) generating unlimited labelled training data
- Dedicated sensor-fault class + autoencoder safety net = field-trustworthy alerts
- Live 6-node terminal dashboard, CSV replay for real datalogger files, full evaluation and benchmark suite
- Deterministic across compilers (custom xorshift64* RNG) — judges reproduce our exact numbers
Verified results
| Metric | Value |
|---|---|
| Held-out accuracy (1,000 unseen samples) | 98.5% |
| Smoldering precision / recall | 99.2% / 98.8% |
| Full assessment latency | ~9 µs |
| Model footprint | 7,950 params ≈ 31 KB |
| Alert after ignition / lead time before flames | +10 min / 80 min |
| False fire alarms on healthy nodes | 0 |
How we built it
C++17 and the standard library. Nothing else. nn.hpp implements dense layers with He initialization, ReLU, softmax and linear heads, full backprop and Adam with bias correction. simulator.hpp models realistic sensor physics so the dataset factory can label events at every stage of development — including the first minutes, which is exactly what early warning demands. The same 31 KB engine trains in ~10 seconds on a laptop and runs one assessment in 9 microseconds — six orders of magnitude under its 5-minute duty cycle, which is why it can run for years on a battery.
Challenges we ran into
- Sensor faults masquerading as normality: a frozen channel inside a 1-hour window is nearly invisible. Fault recall was stuck at 57% until we added two "sensor-health" features (per-channel range normalized by datasheet noise floors) — recall jumped to 96.4%.
- Late-stage fires drifting out of distribution: a fire burning for 2+ hours looked unfamiliar to a model trained on young fires. We widened event-age coverage and taught the model fires preceded by long smolders.
- Bit-for-bit reproducibility across MSVC/Clang/GCC: the C++ standard does not guarantee identical
std::normal_distributionsequences, so we wrote our own xorshift64* + Box–Muller RNG.
What we learned
That the "boring" 20% — fault isolation, alert hysteresis, threshold calibration — is what separates a demo from a deployable system. And that writing backprop by hand teaches you more about ML than importing it ever will.
What's next
Port to Cortex-M/ESP32 (the code already fits), int8 quantization, LoRaWAN mesh alerts between nodes, and a pilot with real low-cost sensor hardware.
Technologies Used
Pure C++17 · CMake · first-party neural network engine (MLP, backprop, Adam, autoencoder) · physics-based simulation · ANSI terminal UI. No frameworks, no cloud, no Python.
Target Users
Forestry agencies and fire departments; utilities with powerline corridors through wildland; insurers underwriting wildland-urban interface property; conservation NGOs; sensor manufacturers needing an open, auditable, royalty-free inference core.
Built With
- anomaly-detection
- autoencoder
- backpropagation
- c++
- cmake
- cpp17
- edge-computing
- embedded-systems
- iot
- machine-learning
- neural-networks
- sensors
- simulation
- wildfire
Log in or sign up for Devpost to join the conversation.