Industry
UWB radar: real-time CNN classification on a Cortex-M33
Full embedded pipeline for an automotive Hands-Free Access system: UWB radar acquisition, time-frequency processing via FFT on DSP, real-time CNN inference on ARM Cortex-M33 (128 kB RAM, 768 kB Flash).
- 99.3%
- Accuracy (validation)
- 11.9 kB
- INT8 model
- 0.1 ms
- Inference latency
01Context
The previous model (1D temporal CNN) had to be retrained per vehicle type. The goal was to design a universal approach based on time-frequency representation, deployable in real time on the NXP Ranger5 MCU without performance trade-offs.
02Technical pipeline
- UWB CIR Acquisition
- FFT 32pts + Hanning
- Time-freq images 20×23×6
- Compact Conv2D CNN
- Real-time INT8 Inference
03What I did
MATLAB simulation of the embedded DSP via NXP DSP Toolbox to replicate Ranger5 behavior and generate ~1100 time-frequency images (CSV) from multi-vehicle CIR recordings. Updated trigger algorithm (IQ segmentation, 384-point window).
Python preprocessing: per-tap normalization, CIR clipping (6×32→6×20), frequency modulation augmentation, false gesture removal via inter-tap cosine similarity, legacy data adaptation (SNR 6.7→11.2) via tap-by-tap statistical alignment.
Conv2D CNN design with Optuna automatic optimization (400 trials, multi-criteria objective: loss, TPR, 1-FPR, size, latency). Hard constraints: <25k parameters, <80 kB float, <30 kB post-quantization. AdamW + ReduceLROnPlateau.
Model optimization: gradual pruning (~49% sparsity/layer), weight clustering (95.62% ratio), QAT 2 phases + PTQ INT8 — 50.94% size reduction (24.33→11.94 kB).
C embedded FFT pipeline implementation (MATLAB autocoder insufficient): BbCopy, Hanning, FFT 32pts, ComplexToPolar, buffer accumulation. TFLite Micro integration: operator resolver, static tensor arena (~60 kB/128 kB RAM), int8 input quantization.
Field clinic testing: 3 participants, kick catalog, CAN reading via Arduino + buzzer. End-to-end pipeline validated on Ranger5: 70% detection, 100% false positive immunity.
04Measured results
- 99.33%
- Global accuracy
- 99.26%
- Detection rate (kicks)
- 99.43%
- False positive immunity
- 11.94 kB
- INT8 model size
- 0.107 ms
- Inference latency
- 184→12 kB
- Compression ×16
- Universal
- cross-vehicle, no retraining
- 70% / 100%
- Field trials: detection / immunity
05Challenges
- Full manual FFT pipeline reimplementation in C (MATLAB autocoder incomplete on custom DSP functions)
- 128 kB RAM: 60 kB tensor arena, iterative trial-and-error adjustment to avoid OOM
- Pruning/clustering without real gains on TFLM Cortex-M33 (no native sparse kernels)
- Legacy data adaptation (hardware SNR differences) via per-tap and per-vehicle statistical alignment
- Python/C mismatch: preprocessing not perfectly aligned, causing detection drop in real conditions
Want to talk it through?
Happy to go into the technical choices, the measurements and what I would do differently.