Projects/02
Best Paper · FIMH 2025
Frugal AI for Automated Defibrillation
Compact ECG models for shockable rhythm detection on STM32 microcontrollers
At Inria and 3IA Côte d'Azur, we worked with Inn'Pulse to develop a compact deep learning system for detecting shockable rhythms from single-lead ECG. The work combined Bayesian architecture search with 8-bit quantization, evaluation across public ECG datasets, and deployment on STM32 hardware. The goal was to support miniaturized defibrillators for use in homes and other places with limited AED access.
Project overview
- Problem
- Detect shockable cardiac rhythms within the hardware budget of a compact defibrillator.
- My contribution
- Developed the models and evaluation pipeline, with Caroline Stehlé’s help on quantization and embedded implementation.
- Approach
- Bayesian architecture search, INT8 quantization and deployment on STM32.
- Constraints
- Balance sensitivity and specificity with memory, latency and power limits.
- Result
- 99.7% sensitivity and 99.3% specificity on held-out 6-second ECG windows; tested on STM32 development boards.
My contribution
I developed the compact ECG models, architecture search, training and evaluation pipeline. Caroline Stehlé helped with INT8 quantization and the embedded implementation on STM32. The project was carried out at Inria with Inn’Pulse.
Why this project
Most cardiac arrests occur in residential settings, where access to automated external defibrillators (AEDs) is often limited. The project aimed to support smaller, more affordable devices by keeping shockable rhythm detection within a microcontroller's memory, latency, and power budget.
Recognition
The Frugal AI for Automated Defibrillation project was awarded 2nd place at the Prix Pierre Laffitte 2025 for its work on compact AI models for automated cardiac defibrillation.
From ECG to embedded inference
- Prepare the ECG data. We combined four public PhysioNet databases (VFDB, CUDB, MITDB, and AFDB), resampled signals to 100 Hz, and formed single-lead ECG windows. Patients were kept separate across training, validation, and test sets. Balanced sampling and augmentation, including noise and baseline wander, addressed class imbalance and signal variability.
- Search for a compact model. Bayesian optimization explored the architecture and training settings of a 1D ResNet. After 143 trials, the selected network had six residual blocks and 102,903 parameters. The models were trained in PyTorch on an NVIDIA Tesla T4 GPU.
- Quantize and deploy. The model was exported to ONNX, then quantized to INT8 with ONNX Runtime using 400 training samples for calibration. STM32Cube.AI supported hardware benchmarking, and we deployed the model through STM32CubeIDE and X-CUBE-AI.
- Evaluate the trade-offs. We tested ECG windows from 2 to 10 seconds and varied the decision threshold to compare sensitivity and specificity. Hardware measurements covered inference latency, memory use, and power consumption.
Results
For 6-second ECG windows, the floating-point model reached 99.7% sensitivity and 99.3% specificity on the held-out test set. The threshold of 0.30 was selected on validation data to balance the two metrics. INT8 quantization preserved performance, with 99.68% sensitivity and 99.36% specificity.
| Measure | Result |
|---|---|
| Shockable rhythm sensitivity, 6-second input | 99.7% |
| Non-shockable rhythm specificity, 6-second input | 99.3% |
| Weight storage after INT8 quantization | 102 KiB, down from 408 KiB |
| RAM for a 10-second input | 120.2 KiB |
| Inference latency, 3-second input on STM32 | 197 ms |
| Inference latency, 10-second input on the local STM32 board | About 659 ms |
The original floating-point model exceeded the deployment memory budget; quantization made it fit. Testing on development boards established embedded feasibility. Integration and validation in a complete AED remain the next step.
Understanding the predictions
We used Grad-CAM to inspect which parts of the ECG influenced a shockable prediction. Across 188 constructed windows containing a transition from non-shockable to shockable rhythm, an average of 85% of the activation mass fell within the shockable half.