Files
ruvnet--RuView/v2/docs/adr/ADR-003-neural-network-inference.md
rUv f49c722764 chore(repo): rename rust-port/wifi-densepose-rs → v2/ (flatten to one level) (#427)
The Rust port lived two directories deep (rust-port/wifi-densepose-rs/)
without any sibling under rust-port/ that warranted the extra level.
Move the whole workspace up to v2/ to match v1/ (Python) at the same
depth and shorten every cd / build command across the repo.

git mv preserves history for all tracked files. 60 files updated for
path references (CI workflows, ADRs, docs, scripts, READMEs, internal
.claude-flow state). Two manual fixes for relative-cd paths in
CLAUDE.md and ADR-043 that became wrong after the depth change
(cd ../.. → cd ..).

Validated:
- cargo check --workspace --no-default-features → clean (after target/
  nuke; the gitignored target/ was carried by the OS rename and had
  hard-coded old paths in build scripts)
- cargo test --workspace --no-default-features → 1,539 passed, 0 failed,
  8 ignored (same totals as pre-rename)
- ESP32-S3 on COM7 → still streaming live CSI (cb #40300, RSSI -64 dBm)

After-merge follow-up: contributors should `rm -rf v2/target` once and
let cargo regenerate from the new path.
2026-04-25 21:28:13 -04:00

1.5 KiB

ADR-003: Neural Network Inference Strategy

Status

Accepted

Context

The WiFi-DensePose system requires neural network inference for:

  1. Modality translation (CSI → visual features)
  2. DensePose estimation (body part segmentation + UV mapping)

We need to select an inference strategy that supports pre-trained models and multiple backends.

Decision

We will implement a multi-backend inference engine:

Primary Backend: ONNX Runtime (ort crate)

  • Load pre-trained PyTorch models exported to ONNX
  • GPU acceleration via CUDA/TensorRT
  • Cross-platform support

Alternative Backends (Feature-gated)

  • tch-rs: PyTorch C++ bindings
  • candle: Pure Rust ML framework

Architecture

pub trait Backend: Send + Sync {
    fn load_model(&mut self, path: &Path) -> NnResult<()>;
    fn run(&self, inputs: HashMap<String, Tensor>) -> NnResult<HashMap<String, Tensor>>;
    fn input_specs(&self) -> Vec<TensorSpec>;
    fn output_specs(&self) -> Vec<TensorSpec>;
}

Feature Flags

[features]
default = ["onnx"]
onnx = ["ort"]
tch-backend = ["tch"]
candle-backend = ["candle-core", "candle-nn"]
cuda = ["ort/cuda"]
tensorrt = ["ort/tensorrt"]

Consequences

Positive

  • Use existing trained models (no retraining)
  • Multiple backend options for different deployments
  • GPU acceleration when available
  • Feature flags minimize binary size

Negative

  • ONNX model conversion required
  • ort crate pulls in C++ dependencies
  • tch requires libtorch installation