wifi-densepose/v2/crates
ruv 8fb6ef6547 fix(vitals): renormalize partial-weight fusion + clamp IIR resonator (ADR-157 §A2/§A3)
§A2 (correctness): BreathingExtractor weighted fusion was an un-normalized sum.
When `weights` was supplied shorter than n, supplied entries were used raw while
the missing tail defaulted to uniform 1/n -- two scales summed with no
renormalization, silently mis-scaling the breathing signal by a factor of
weights.len(). Extract to fuse_weighted_residuals() and normalize by
Sigma(effective weights), mirroring heartrate::compute_phase_coherence_signal.
Tests: partial_weights_are_renormalized_not_scale_mixed,
partial_weights_fusion_is_weighted_average (both fail on old code).

§A3 (stability): the IIR resonator pole radius r = 1 - bw/2 diverges when the
pole MAGNITUDE |r| >= 1 (i.e. bw >= 4: a very low fs relative to band width) --
NOT merely when r is negative, as the research report stated (a negative r with
|r| < 1 is still stable; the comments/tests are corrected accordingly). On
divergence the filter overflows to +/-inf within ~600 frames, NaN-poisons acf0,
and the extractor stalls permanently. Clamp r to [0, 0.9999] AND finite-guard
the filter output before the history push (defense-in-depth, mirrors ADR-154 §3).
Applied to both heartrate.rs and breathing.rs. Tests:
{heartrate,breathing}::low_sample_rate_filter_stays_finite (fs=0.5, 0.1-0.9 Hz
band, 600-frame unit step -> all-finite; both panic on old code).

These files also carry the §A1 VecDeque window conversion (bit-identical).

Co-Authored-By: claude-flow <ruv@ruv.net>
2026-06-11 21:00:19 -04:00
..
cog-ha-matter chore(cogs): publish cog-ha-matter 0.3.0 + bump signal/sensing-server to 0.3.1 2026-05-25 11:01:46 -04:00
cog-person-count chore(cogs): publish cog-person-count + cog-pose-estimation 0.3.0 to crates.io 2026-05-25 10:52:47 -04:00
cog-pose-estimation test(cog-pose): cross-language adapter integration (Python producer -> Rust engine) 2026-05-31 05:22:54 -04:00
homecore docs(homecore): comprehensive README — state machine + event bus + registries 2026-05-25 23:09:16 -04:00
homecore-api feat(homecore iter 3): DELETE /api/states/<id> + confirm modal in UI 2026-05-26 15:03:40 -04:00
homecore-assist docs(homecore-assist): comprehensive README — intent recognition + Ruflo agent bridge 2026-05-25 23:13:20 -04:00
homecore-automation docs(homecore-automation): comprehensive README — YAML triggers + conditions + MiniJinja actions 2026-05-25 23:12:41 -04:00
homecore-hap docs(homecore-hap): comprehensive README — HomeKit bridge with 11 accessory types 2026-05-25 23:11:15 -04:00
homecore-migrate docs(homecore-migrate): comprehensive README — HA entity/device/config import + migration CLI 2026-05-25 23:13:58 -04:00
homecore-plugin-example HOMECORE: native Rust/WASM/TS port of Home Assistant — ADRs 125-134 implementation (#800) 2026-05-25 22:47:48 -04:00
homecore-plugins docs(homecore-plugins): comprehensive README — WASM plugin runtime + InProcess registry 2026-05-25 23:10:35 -04:00
homecore-recorder docs(homecore-recorder): comprehensive README — SQLite history + ruvector semantic search 2026-05-25 23:11:59 -04:00
homecore-server feat(homecore-server): seed 10 default entities on boot (--no-seed-entities to opt out) 2026-05-26 14:18:28 -04:00
nvsim fix(security): audit — fix RUSTSEC vulns, clippy warnings, dead code (#769) 2026-05-23 05:36:13 -04:00
nvsim-server fix(security): audit — fix RUSTSEC vulns, clippy warnings, dead code (#769) 2026-05-23 05:36:13 -04:00
ruv-neural@1ece3afa33 chore: extract ruv-neural to ruvnet/ruv-neural, wire as submodule (#1019) 2026-06-11 18:12:51 -04:00
ruview-swarm fix(ruview-swarm): clippy manual_is_multiple_of in lawnmower planner 2026-05-31 10:41:05 -04:00
wifi-densepose-bfld fix(bfld): gate PrivacyAttestationProof::compute behind std 2026-05-31 10:45:38 -04:00
wifi-densepose-calibration ADR-152: WiFi-Pose SOTA 2026 intake — WiFlow-STD benchmark, Rust integrations, ADR-153 802.11bf layer, efficiency frontier (#1008) 2026-06-11 17:02:23 -04:00
wifi-densepose-cli ADR-152: WiFi-Pose SOTA 2026 intake — WiFlow-STD benchmark, Rust integrations, ADR-153 802.11bf layer, efficiency frontier (#1008) 2026-06-11 17:02:23 -04:00
wifi-densepose-core Beyond-SOTA engine/signal/train improvements: mesh partition guard, FFT CIR solver, canonical frame decoder, falsifiable occupancy benchmark, governed streaming, adapter provenance (#1018) 2026-06-11 16:08:54 -04:00
wifi-densepose-desktop fix(server): make synthetic CSI opt-in only (sibling fix to #937) (#979) 2026-06-08 18:07:39 +02:00
wifi-densepose-engine Beyond-SOTA engine/signal/train improvements: mesh partition guard, FFT CIR solver, canonical frame decoder, falsifiable occupancy benchmark, governed streaming, adapter provenance (#1018) 2026-06-11 16:08:54 -04:00
wifi-densepose-geo release: version bumps for crates.io publish (streaming-engine cascade) 2026-05-29 09:26:38 -04:00
wifi-densepose-hardware ADR-152: WiFi-Pose SOTA 2026 intake — WiFlow-STD benchmark, Rust integrations, ADR-153 802.11bf layer, efficiency frontier (#1008) 2026-06-11 17:02:23 -04:00
wifi-densepose-mat Beyond-SOTA engine/signal/train improvements: mesh partition guard, FFT CIR solver, canonical frame decoder, falsifiable occupancy benchmark, governed streaming, adapter provenance (#1018) 2026-06-11 16:08:54 -04:00
wifi-densepose-nn perf(nn): zero-copy ORT input (~1.48x) + dynamic-dim guard + concurrency bench (ADR-155 §Tier-3) 2026-06-11 19:57:53 -04:00
wifi-densepose-occworld-candle feat(worldmodel): Candle Rust port + GCP GPU scripts (ADR-147 Phase 4+6) 2026-05-29 20:52:51 -04:00
wifi-densepose-pointcloud fix(security): audit — fix RUSTSEC vulns, clippy warnings, dead code (#769) 2026-05-23 05:36:13 -04:00
wifi-densepose-ruvector perf(ruvector): eliminate fuse() double-clone (~2.17x marshalling) + bench (ADR-156 §2.4, §4) 2026-06-11 20:23:27 -04:00
wifi-densepose-sensing-server fix(train): unify 7 divergent PCK/OKS into one canonical metric (ADR-155 §Tier-1.1) 2026-06-11 19:56:44 -04:00
wifi-densepose-signal perf(signal): cache PSD FFT planner (2.0–3.1x) + honor DTW band (2.4–4.1x) (ADR-154 M0) 2026-06-11 19:21:12 -04:00
wifi-densepose-train fix(train,nn): Tier-2 correctness/security — metric scale, OOM bounds, panics (ADR-155 §Tier-2) 2026-06-11 19:57:32 -04:00
wifi-densepose-vitals fix(vitals): renormalize partial-weight fusion + clamp IIR resonator (ADR-157 §A2/§A3) 2026-06-11 21:00:19 -04:00
wifi-densepose-wasm fix(security): audit — fix RUSTSEC vulns, clippy warnings, dead code (#769) 2026-05-23 05:36:13 -04:00
wifi-densepose-wasm-edge feat(nvsim): full simulator stack — Rust crate, dashboard, server, App Store, Ghost Murmur [ADR-089/090/091/092/093] 2026-04-27 12:41:01 -04:00
wifi-densepose-wifiscan perf(vitals,wifiscan): O(1) VecDeque sliding windows + vitals bench (ADR-157 §A1/§D1) 2026-06-11 20:59:57 -04:00
wifi-densepose-worldgraph Beyond-SOTA engine/signal/train improvements: mesh partition guard, FFT CIR solver, canonical frame decoder, falsifiable occupancy benchmark, governed streaming, adapter provenance (#1018) 2026-06-11 16:08:54 -04:00
wifi-densepose-worldmodel feat: per-room calibration system (ADR-151) + cognitum-v0 appliance integration spec (#989) 2026-06-10 15:21:09 -04:00
README.md chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427) 2026-04-25 21:28:13 -04:00

README.md

WiFi-DensePose Rust Crates

License: MIT OR Apache-2.0 Rust 1.85+ Workspace RuVector v2.0.4 Tests

See through walls with WiFi. No cameras. No wearables. Just radio waves.

A modular Rust workspace for WiFi-based human pose estimation, vital sign monitoring, and disaster response using Channel State Information (CSI). Built on RuVector graph algorithms and the WiFi-DensePose research platform by rUv.


Performance

Operation Python v1 Rust v2 Speedup
CSI Preprocessing ~5 ms 5.19 us ~1000x
Phase Sanitization ~3 ms 3.84 us ~780x
Feature Extraction ~8 ms 9.03 us ~890x
Motion Detection ~1 ms 186 ns ~5400x
Full Pipeline ~15 ms 18.47 us ~810x
Vital Signs N/A 86 us (11,665 fps) --

Crate Overview

Core Foundation

Crate Description crates.io
wifi-densepose-core Types, traits, and utilities (CsiFrame, PoseEstimate, SignalProcessor) crates.io
wifi-densepose-config Configuration management (env, TOML, YAML) crates.io
wifi-densepose-db Database persistence (PostgreSQL, SQLite, Redis) crates.io

Signal Processing & Sensing

Crate Description RuVector Integration crates.io
wifi-densepose-signal SOTA CSI signal processing (6 algorithms from SpotFi, FarSense, Widar 3.0) ruvector-mincut, ruvector-attn-mincut, ruvector-attention, ruvector-solver crates.io
wifi-densepose-vitals Vital sign extraction: breathing (6-30 BPM) and heart rate (40-120 BPM) -- crates.io
wifi-densepose-wifiscan Multi-BSSID WiFi scanning for Windows-enhanced sensing -- crates.io

Neural Network & Training

Crate Description RuVector Integration crates.io
wifi-densepose-nn Multi-backend inference (ONNX, PyTorch, Candle) with DensePose head (24 body parts) -- crates.io
wifi-densepose-train Training pipeline with MM-Fi dataset, 114->56 subcarrier interpolation All 5 crates crates.io

Disaster Response

Crate Description RuVector Integration crates.io
wifi-densepose-mat Mass Casualty Assessment Tool -- survivor detection, triage, multi-AP localization ruvector-solver, ruvector-temporal-tensor crates.io

Hardware & Deployment

Crate Description crates.io
wifi-densepose-hardware ESP32, Intel 5300, Atheros CSI sensor interfaces (pure Rust, no FFI) crates.io
wifi-densepose-wasm WebAssembly bindings for browser-based disaster dashboard crates.io
wifi-densepose-sensing-server Axum server: ESP32 UDP ingestion, WebSocket broadcast, sensing UI crates.io

Applications

Crate Description crates.io
wifi-densepose-api REST + WebSocket API layer crates.io
wifi-densepose-cli Command-line tool for MAT disaster scanning crates.io

Architecture

                          wifi-densepose-core
                         (types, traits, errors)
                                  |
              +-------------------+-------------------+
              |                   |                   |
    wifi-densepose-signal   wifi-densepose-nn   wifi-densepose-hardware
    (CSI processing)        (inference)         (ESP32, Intel 5300)
    + ruvector-mincut       + ONNX Runtime          |
    + ruvector-attn-mincut  + PyTorch (tch)   wifi-densepose-vitals
    + ruvector-attention    + Candle          (breathing, heart rate)
    + ruvector-solver            |
              |                  |             wifi-densepose-wifiscan
              +--------+---------+            (BSSID scanning)
                       |
          +------------+------------+
          |                         |
  wifi-densepose-train    wifi-densepose-mat
  (training pipeline)     (disaster response)
  + ALL 5 ruvector        + ruvector-solver
                          + ruvector-temporal-tensor
                                |
              +-----------------+-----------------+
              |                 |                 |
    wifi-densepose-api  wifi-densepose-wasm  wifi-densepose-cli
    (REST/WS)           (browser WASM)       (CLI tool)
              |
    wifi-densepose-sensing-server
    (Axum + WebSocket)

RuVector Integration

All RuVector crates at v2.0.4 from crates.io:

RuVector Crate Used In Purpose
ruvector-mincut signal, train Dynamic min-cut for subcarrier selection & person matching
ruvector-attn-mincut signal, train Attention-weighted min-cut for antenna gating & spectrograms
ruvector-temporal-tensor train, mat Tiered temporal compression (4-10x memory reduction)
ruvector-solver signal, train, mat Sparse Neumann solver for interpolation & triangulation
ruvector-attention signal, train Scaled dot-product attention for spatial features & BVP

Signal Processing Algorithms

Six state-of-the-art algorithms implemented in wifi-densepose-signal:

Algorithm Paper Year Module
Conjugate Multiplication SpotFi (SIGCOMM) 2015 csi_ratio.rs
Hampel Filter WiGest 2015 hampel.rs
Fresnel Zone Model FarSense (MobiCom) 2019 fresnel.rs
CSI Spectrogram Standard STFT 2018+ spectrogram.rs
Subcarrier Selection WiDance (MobiCom) 2017 subcarrier_selection.rs
Body Velocity Profile Widar 3.0 (MobiSys) 2019 bvp.rs

Quick Start

As a Library

use wifi_densepose_core::{CsiFrame, CsiMetadata, SignalProcessor};
use wifi_densepose_signal::{CsiProcessor, CsiProcessorConfig};

// Configure the CSI processor
let config = CsiProcessorConfig::default();
let processor = CsiProcessor::new(config);

// Process a CSI frame
let frame = CsiFrame { /* ... */ };
let processed = processor.process(&frame)?;

Vital Sign Monitoring

use wifi_densepose_vitals::{
    CsiVitalPreprocessor, BreathingExtractor, HeartRateExtractor,
    VitalAnomalyDetector,
};

let mut preprocessor = CsiVitalPreprocessor::new(56); // 56 subcarriers
let mut breathing = BreathingExtractor::new(100.0);    // 100 Hz sample rate
let mut heartrate = HeartRateExtractor::new(100.0);

// Feed CSI frames and extract vitals
for frame in csi_stream {
    let residuals = preprocessor.update(&frame.amplitudes);
    if let Some(bpm) = breathing.push_residuals(&residuals) {
        println!("Breathing: {:.1} BPM", bpm);
    }
}

Disaster Response (MAT)

use wifi_densepose_mat::{DisasterResponse, DisasterConfig, DisasterType};

let config = DisasterConfig {
    disaster_type: DisasterType::Earthquake,
    max_scan_zones: 16,
    ..Default::default()
};

let mut responder = DisasterResponse::new(config);
responder.add_scan_zone(zone)?;
responder.start_continuous_scan().await?;

Hardware (ESP32)

use wifi_densepose_hardware::{Esp32CsiParser, CsiFrame};

let parser = Esp32CsiParser::new();
let raw_bytes: &[u8] = /* UDP packet from ESP32 */;
let frame: CsiFrame = parser.parse(raw_bytes)?;
println!("RSSI: {} dBm, {} subcarriers", frame.metadata.rssi, frame.subcarriers.len());

Training

# Check training crate (no GPU needed)
cargo check -p wifi-densepose-train --no-default-features

# Run training with GPU (requires tch/libtorch)
cargo run -p wifi-densepose-train --features tch-backend --bin train -- \
    --config training.toml --dataset /path/to/mmfi

# Verify deterministic training proof
cargo run -p wifi-densepose-train --features tch-backend --bin verify-training

Building

# Clone the repository
git clone https://github.com/ruvnet/wifi-densepose.git
cd wifi-densepose/v2

# Check workspace (no GPU dependencies)
cargo check --workspace --no-default-features

# Run all tests
cargo test --workspace --no-default-features

# Build release
cargo build --release --workspace

Feature Flags

Crate Feature Description
wifi-densepose-nn onnx (default) ONNX Runtime backend
wifi-densepose-nn tch-backend PyTorch (libtorch) backend
wifi-densepose-nn candle-backend Candle (pure Rust) backend
wifi-densepose-nn cuda CUDA GPU acceleration
wifi-densepose-train tch-backend Enable GPU training modules
wifi-densepose-mat ruvector (default) RuVector graph algorithms
wifi-densepose-mat api (default) REST + WebSocket API
wifi-densepose-mat distributed Multi-node coordination
wifi-densepose-mat drone Drone-mounted scanning
wifi-densepose-hardware esp32 ESP32 protocol support
wifi-densepose-hardware intel5300 Intel 5300 CSI Tool
wifi-densepose-hardware linux-wifi Linux commodity WiFi
wifi-densepose-wifiscan wlanapi Windows WLAN API async scanning
wifi-densepose-core serde Serialization support
wifi-densepose-core async Async trait support

Testing

# Unit tests (all crates)
cargo test --workspace --no-default-features

# Signal processing benchmarks
cargo bench -p wifi-densepose-signal

# Training benchmarks
cargo bench -p wifi-densepose-train --no-default-features

# Detection benchmarks
cargo bench -p wifi-densepose-mat

Supported Hardware

Hardware Crate Feature CSI Subcarriers Cost
ESP32-S3 Mesh (3-6 nodes) hardware/esp32 52-56 ~$54
Intel 5300 NIC hardware/intel5300 30 ~$50
Atheros AR9580 hardware/linux-wifi 56 ~$100
Any WiFi (Windows/Linux) wifiscan RSSI-only $0

Architecture Decision Records

Key design decisions documented in docs/adr/:

ADR Title Status
ADR-014 SOTA Signal Processing Accepted
ADR-015 MM-Fi + Wi-Pose Training Datasets Accepted
ADR-016 RuVector Training Pipeline Accepted (Complete)
ADR-017 RuVector Signal + MAT Integration Accepted
ADR-021 Vital Sign Detection Pipeline Accepted
ADR-022 Windows WiFi Enhanced Sensing Accepted
ADR-024 Contrastive CSI Embedding Model Accepted
  • WiFi-DensePose -- Main repository (Python v1 + Rust v2)
  • RuVector -- Graph algorithms for neural networks (5 crates, v2.0.4)
  • rUv -- Creator and maintainer

License

All crates are dual-licensed under MIT OR Apache-2.0.

Copyright (c) 2024 rUv