wifi-densepose/v2/crates/wifi-densepose-train
rUv 0f64d23516
feat(bench): int8 quantization of WiFlow-STD half pose model — MEASURED trade-off (ADR-175, honest negative) (#1095)
Sub-deliverable 8.2 of the benchmark/optimization milestone. Quantizes the
843,834-param "half" WiFlow-STD pose model (half_best.pth) to int8 two ways and
MEASURES the accuracy/size trade-off vs fp32 under ONE locked normalization
(ADR-173 torso-diameter PCK, upstream calculate_pck use_torso_norm=True), on the
same seed-42 file-level 70/15/15 test split that produced the fp32 sweep numbers.

MEASURED on ruvultra (RTX 5080, torch 2.11.0+cu128, fbgemm; clean test, torso-PCK):
  fp32             96.62% pck@20  99.47% pck@50  0.008981 mpjpe  3.351 MB
  int8 PTQ static  40.98% pck@20  94.98% pck@50  0.038262 mpjpe  1.046 MB  (-55.64pp)
  int8 QAT (3 ep)  67.48% pck@20  98.69% pck@50  0.026548 mpjpe  1.043 MB  (-29.15pp)

Verdict (honest no): int8 is NOT a win at the strict PCK@20 edge target. Static
PTQ collapses; QAT recovers a large share but still loses 29 pp @20 for a 3.2x
size win — keep fp32/fp16 on the edge. Disclosed: QAT fake-quant val pck@20 was
83.45% but converted int8 scores 67.48% (~16pp convert_fx gap, reported honestly).

Deliverables:
- v2/crates/wifi-densepose-train/scripts/quantize_half_int8.py (reproducible:
  header carries the exact ssh command + run date; QAT primary, static PTQ fallback)
- docs/adr/ADR-175-int8-quantization-half-pose-model-measured.md (MEASURED table,
  locked normalization, QAT-vs-PTQ labeling, verdict, reproduction, limitations)
- CHANGELOG [Unreleased] ### Added entry

No production Rust or signal-pipeline change. Python deterministic proof unchanged
(f8e76f21a0f9852b70b6d9dd5318239f6b20cbcb4cdd995863263cecdc446f7a, bit-exact).
2026-06-15 09:16:22 -04:00
..
benches fix(train): unify 7 divergent PCK/OKS into one canonical metric (ADR-155 §Tier-1.1) 2026-06-11 19:56:44 -04:00
scripts feat(bench): int8 quantization of WiFlow-STD half pose model — MEASURED trade-off (ADR-175, honest negative) (#1095) 2026-06-15 09:16:22 -04:00
src feat(train): metric-locked PCK/MPJPE accuracy harness + ADR-173 (resolve PCK-definition ambiguity) (#1092) 2026-06-15 00:41:02 -04:00
tests feat(train): metric-locked PCK/MPJPE accuracy harness + ADR-173 (resolve PCK-definition ambiguity) (#1092) 2026-06-15 00:41:02 -04:00
Cargo.toml release: bump 9 crates changed in the beyond-SOTA sweep for crates.io 2026-06-11 22:41:21 -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-train

Crates.io Documentation License

Complete training pipeline for WiFi-DensePose, integrated with all five ruvector crates.

Overview

wifi-densepose-train provides everything needed to train the WiFi-to-DensePose model: dataset loading, subcarrier interpolation, loss functions, evaluation metrics, and the training loop orchestrator. It supports both the MM-Fi dataset (NeurIPS 2023) and deterministic synthetic data for reproducible experiments.

Without the tch-backend feature the crate still provides the dataset, configuration, and subcarrier interpolation APIs needed for data preprocessing and proof verification.

Features

  • MM-Fi dataset loader -- Reads the MM-Fi multimodal dataset (NeurIPS 2023) from disk with memory-mapped .npy files.
  • Synthetic dataset -- Deterministic, fixed-seed CSI generation for unit tests and proofs.
  • Subcarrier interpolation -- 114 -> 56 subcarrier compression via ruvector-solver sparse interpolation with variance-based selection.
  • Loss functions (tch-backend) -- Pose estimation losses including MSE, OKS, and combined multi-task loss.
  • Metrics (tch-backend) -- PCKh, OKS-AP, and per-keypoint evaluation with ruvector-mincut-based person matching.
  • Training orchestrator (tch-backend) -- Full training loop with learning rate scheduling, gradient clipping, checkpointing, and reproducible proofs.
  • All 5 ruvector crates -- ruvector-mincut, ruvector-attn-mincut, ruvector-temporal-tensor, ruvector-solver, and ruvector-attention integrated across dataset loading, metrics, and model attention.

Feature flags

Flag Default Description
tch-backend no Enable PyTorch training via tch-rs
cuda no CUDA GPU acceleration (implies tch)

Binaries

Binary Description
train Main training entry point
verify-training Proof verification (requires tch-backend)

Quick Start

use wifi_densepose_train::config::TrainingConfig;
use wifi_densepose_train::dataset::{SyntheticCsiDataset, SyntheticConfig, CsiDataset};

// Build and validate config
let config = TrainingConfig::default();
config.validate().expect("config is valid");

// Create a synthetic dataset (deterministic, fixed-seed)
let syn_cfg = SyntheticConfig::default();
let dataset = SyntheticCsiDataset::new(200, syn_cfg);

// Load one sample
let sample = dataset.get(0).unwrap();
println!("amplitude shape: {:?}", sample.amplitude.shape());

Architecture

wifi-densepose-train/src/
  lib.rs            -- Re-exports, VERSION
  config.rs         -- TrainingConfig, hyperparameters, validation
  dataset.rs        -- CsiDataset trait, MmFiDataset, SyntheticCsiDataset, DataLoader
  error.rs          -- TrainError, ConfigError, DatasetError, SubcarrierError
  subcarrier.rs     -- interpolate_subcarriers (114->56), variance-based selection
  losses.rs         -- (tch) MSE, OKS, multi-task loss        [feature-gated]
  metrics.rs        -- (tch) PCKh, OKS-AP, person matching     [feature-gated]
  model.rs          -- (tch) Model definition with attention    [feature-gated]
  proof.rs          -- (tch) Deterministic training proofs      [feature-gated]
  trainer.rs        -- (tch) Training loop orchestrator         [feature-gated]
Crate Role
wifi-densepose-signal Signal preprocessing consumed by dataset loaders
wifi-densepose-nn Inference engine that loads trained models
ruvector-mincut Person matching in metrics
ruvector-attn-mincut Attention-weighted graph cuts
ruvector-temporal-tensor Compressed CSI buffering in datasets
ruvector-solver Sparse subcarrier interpolation
ruvector-attention Spatial attention in model

License

MIT OR Apache-2.0