Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Edge AI & Classification

Classification is where Wi-Fi sensing pays off and where it most often disappoints. The disappointment is usually not the model — it is the framing, the features, or the assumption that a result measured in one room will hold in another.

This section is about getting those three right. It names third-party crates where they are useful; none of them is part of csi-rs.

Pick the Easiest Task That Solves Your Problem

Sensing tasks form a ladder, and each rung costs substantially more than the one below in data, in model size, and in how badly it degrades when the environment changes.

TaskWhat it decidesDifficulty
Presence detectionIs anyone here?Easiest; often a threshold on variance
Motion detectionIs anything moving?Easy; a filtered variance over time
Occupancy countingHow many people?Hard; degrades fast beyond two or three
Activity recognitionWalking, sitting, fallingHard; needs labelled data per environment
Gesture recognitionWhich of a fixed setHard; very sensitive to position
Vital signsBreathing and heart rateHardest; needs a still subject and phase

The single most common mistake is reaching for the bottom of that table when the top would do. Presence detection frequently needs no model at all — the variance of filtered amplitude across subcarriers, thresholded against a baseline measured in an empty room, is a genuinely effective detector, and it runs in a CSI callback on a device with no floating-point unit to spare.

Spend the model budget where a threshold demonstrably fails.

Features Beat Architecture

CSI is not an image, and treating it as one wastes most of what you have. The representations that carry the most signal per parameter:

  • Amplitude across subcarriers, over a time window. The basic input. Shape it as (subcarriers × time).
  • Variance or standard deviation per subcarrier over a window. Motion raises it; a static environment does not.
  • Principal components of the amplitude matrix. The first two or three usually carry the motion, and the reduction from 52 dimensions to 3 is what makes a small model viable.
  • Doppler spectrograms from a short-time Fourier transform. Most published activity-recognition results operate on these, because the transform makes motion explicit rather than leaving the model to discover it.
  • Phase with the oscillator terms removed, or phase differences between antennas. Powerful, and only after the correction described in Signal Processing in Rust. Raw phase is dominated by hardware offsets and will teach a model nothing but the oscillator.

Two properties of the capture matter as much as the feature choice. Sampling rate bounds what you can see — Doppler from walking needs tens of packets per second, breathing needs a stable rate more than a high one, and nothing recovers detail the packet rate did not carry. And an emitter at a fixed period gives far more uniform sampling than ambient traffic, which is why the controlled pairing is the right arrangement for anything you intend to model.

The Domain Problem

Both earlier chapters flagged environment-specific calibration as the field’s central open problem, and it deserves stating plainly here, because it is the thing most likely to invalidate a result you are pleased with.

A model trained in one room will degrade in another. Often severely. The channel response encodes the room’s geometry, the furniture, the wall materials, and the exact positions of the transmitter and receiver, alongside the human activity you care about — and the model has no way to know which is which. Move a node by a metre and the input distribution shifts.

Mitigations exist and none of them is a solution:

  • Train across domains. Widar 3.0 exists for precisely this reason — 258,000 gesture instances across 75 physical domains.
  • Choose domain-invariant features. Doppler is less position-dependent than raw amplitude; the CSI ratio between antennas cancels hardware-specific offsets.
  • Calibrate on deployment. Record a baseline in the empty environment and normalise against it. Cheap, and effective for presence and motion.
  • Fine-tune on site. Powerful when you can collect a little labelled data in the real environment, and often impractical.

The honest framing for a deployment is that some on-site calibration will be required, and designing for it from the start is cheaper than discovering it after a pilot.

Where Inference Runs

On the host is the default and should be. Once the stream is Parquet, the whole Python scientific stack applies — including SenseFi, which exists to benchmark deep models on exactly this data. Prototype here. Always.

On the device is worth it when the constraint is airtime, power, or privacy rather than accuracy. A node that transmits “motion detected” instead of 100 CSI packets a second uses a tiny fraction of the airtime and power, and never puts channel measurements of someone’s home on a network. The ceiling is low — these are microcontrollers with a few hundred kilobytes of RAM — but the tasks at the top of the ladder fit under it comfortably.

For on-device inference in Rust, the honest state of the ecosystem:

  • microflow — a no_std inference engine designed for microcontrollers. The most direct fit for this hardware.
  • burn — a full framework with a no_std story; heavier, and the right choice if you are also training in Rust.
  • candle and tract — host-side inference. tract is the more practical of the two for running an exported ONNX model in a Rust host application.

Classical methods deserve a fairer hearing than they usually get. A decision tree, an SVM, or a threshold on a well-chosen feature will fit in a callback, needs no framework, and is frequently competitive on the tasks at the top of the ladder. Reach for a neural network when you have measured that you need one.

Datasets to Start From

Rather than collecting from scratch, the datasets introduced in CSI Enabled Literature & Projects are the fastest way to get a baseline:

  • MM-Fi — multimodal, aligning CSI with RGB-D, LiDAR, and mmWave. The cross-modal alignment is what makes labelling tractable.
  • Widar 3.0 — gesture-focused, and the reference for cross-domain evaluation.
  • NTU-Fi — 114 subcarriers per antenna pair, covering activities and gait.

Use them to establish that your pipeline and model are sound. Then collect in your own environment anyway, because of everything in the section above.

Summary

In this section we looked at:

  • The ladder of sensing tasks, and why the top rungs often need no model.
  • The features that carry the most signal — variance, principal components, Doppler spectrograms, corrected phase — and why raw phase is not among them.
  • Domain dependence as the field’s central unsolved problem, and the partial mitigations available.
  • Where inference should run, and the Rust crates for each placement.
  • The public datasets worth starting from.