Input signals
Speed, HR, RR, VE, age, weight, height, and sex are sampled into 60-second windows.
Think of this as a simplified VO2max engine behind a sport watch experience: a Garmin or Apple Watch style device reads exercise signals such as speed, heart rate, breathing rate, and ventilation, then estimates aerobic fitness. This project keeps that idea small enough for low-power devices by using sparse spike signals and pruning redundant model weights.
What the project does
VO2max is a strong marker of aerobic capacity, but direct lab measurement is expensive and inconvenient. This project uses treadmill test signals and subject metadata to train a compact temporal model that can run closer to a wearable device.
Speed, HR, RR, VE, age, weight, height, and sex are sampled into 60-second windows.
Dilated TCN blocks extract local and longer-range exercise dynamics from each window.
Two LIF-style SNN layers integrate current, leak membrane potential, and emit sparse spikes.
Magnitude pruning and 8-bit quantization reduce model cost with only a small accuracy drop.
Join subject information with treadmill measurements by ID_test, remove missing VO2/VCO2/VE/HR rows, and encode sex as a numeric feature.
Interpolate each test to 1 Hz, slice 60-second sequences, and use 50% overlap to preserve temporal continuity.
Four Conv1d blocks use dilation 1, 2, 4, and 8 to widen the receptive field while keeping the sequence length.
Spiking layers convert the TCN output into a sparse time code, average it, then predict VO2 and VO2max with two heads.
Surrogate gradient implementation
A spiking neuron outputs only 0 or 1. That is efficient for a wearable device, but it creates a training problem: a hard 0/1 step has no useful normal gradient. The workaround is to keep the hard spike in the forward pass, then use a smooth surrogate slope during backpropagation so the model can learn.
Formula source: the project report section "Surrogate Gradient Implementation". The report cites Li et al. (2021), "Wearable-based Human Activity Recognition with Spatio-Temporal Spiking Neural Networks", for the surrogate-gradient idea, and Liu and Wang (2001) for the LIF spiking-neuron background.
The neuron fires only when membrane potential passes the threshold.
Training uses this triangular slope near the threshold instead of a zero gradient.
The report uses this simplified linear form inside the active surrogate region.
Interactive demo
The canvas turns the project workflow into a readable animation: raw treadmill signals become overlapping windows, the TCN scans the sequence, the SNN emits sparse spikes, then compression removes redundant weights.
The workout gets harder step by step, like a treadmill test where speed rises until the athlete is near max effort.
The athlete stays at a mostly stable pace. Signals change slowly, so the model sees a smoother pattern.
Hard and easy segments alternate. The model must react to quick jumps in heart-rate and breathing signals.
Results
The model remains stable after 70% pruning and 8-bit quantization. The largest change is a modest VO2 RMSE increase, while VO2max RMSE changes by only 10 ml/min.
Baseline was 0.893, a 1.5% absolute drop.
Baseline was 0.596, a 1.7% absolute drop.
Global magnitude pruning over Conv1d and Linear weights.
Data & methodology
This demo is built on a published research dataset and an established backpropagation method for spiking neural networks.
Source dataset. Treadmill maximal-exercise time-series come from the Exercise Physiology and Human Performance Lab of the University of Málaga, published on PhysioNet by Mongin, García Romero, and Álvero Cruz (2021). Treadmill maximal exercise tests from the Exercise Physiology and Human Performance Lab of the University of Malaga, version 1.0.1. DOI 10.13026/7ezk-j442 (RRID: SCR_007345).
Surrogate-gradient training for SNNs. Backpropagation through the non-differentiable spike emission follows the surrogate-gradient approach described in Li et al. (2021), “Wearable-based human activity recognition with spatio-temporal spiking neural networks”, arXiv:2108.05047. arxiv.org/abs/2108.05047