12,126 lines of new Rust code across 22 modules with 285 tests: ADR-029 RuvSense Core (signal crate, 10 modules): - multiband.rs: Multi-band CSI frame fusion from channel hopping - phase_align.rs: Cross-channel LO phase rotation correction - multistatic.rs: Attention-weighted cross-node viewpoint fusion - coherence.rs: Z-score per-subcarrier coherence scoring - coherence_gate.rs: Accept/PredictOnly/Reject/Recalibrate gating - pose_tracker.rs: 17-keypoint Kalman tracker with re-ID - mod.rs: Pipeline orchestrator ADR-030 Persistent Field Model (signal crate, 7 modules): - field_model.rs: SVD-based room eigenstructure, Welford stats - tomography.rs: Coarse RF tomography from link attenuations (ISTA) - longitudinal.rs: Personal baseline drift detection over days - intention.rs: Pre-movement prediction (200-500ms lead signals) - cross_room.rs: Cross-room identity continuity - gesture.rs: Gesture classification via DTW template matching - adversarial.rs: Physically impossible signal detection ADR-031 RuView (ruvector crate, 5 modules): - attention.rs: Scaled dot-product with geometric bias - geometry.rs: Geometric Diversity Index, Cramer-Rao bounds - coherence.rs: Phase phasor coherence gating - fusion.rs: MultistaticArray aggregate, fusion orchestrator - mod.rs: Module exports Training & Hardware: - ruview_metrics.rs: 3-metric acceptance test (PCK/OKS, MOTA, vitals) - esp32/tdm.rs: TDM sensing protocol, sync beacons, drift compensation - Firmware: channel hopping, NDP injection, NVS config extensions Security fixes: - field_model.rs: saturating_sub prevents timestamp underflow - longitudinal.rs: FIFO eviction note for bounded buffer README updated with RuvSense section, new feature badges, changelog v3.1.0. Co-Authored-By: claude-flow <ruv@ruv.net>
92 lines
3.3 KiB
Rust
92 lines
3.3 KiB
Rust
//! # WiFi-DensePose Training Infrastructure
|
|
//!
|
|
//! This crate provides the complete training pipeline for the WiFi-DensePose pose
|
|
//! estimation model. It includes configuration management, dataset loading with
|
|
//! subcarrier interpolation, loss functions, evaluation metrics, and the training
|
|
//! loop orchestrator.
|
|
//!
|
|
//! ## Architecture
|
|
//!
|
|
//! ```text
|
|
//! TrainingConfig ──► Trainer ──► Model
|
|
//! │ │
|
|
//! │ DataLoader
|
|
//! │ │
|
|
//! │ CsiDataset (MmFiDataset | SyntheticCsiDataset)
|
|
//! │ │
|
|
//! │ subcarrier::interpolate_subcarriers
|
|
//! │
|
|
//! └──► losses / metrics
|
|
//! ```
|
|
//!
|
|
//! ## Quick Start
|
|
//!
|
|
//! ```rust,no_run
|
|
//! use wifi_densepose_train::config::TrainingConfig;
|
|
//! use wifi_densepose_train::dataset::{SyntheticCsiDataset, SyntheticConfig, CsiDataset};
|
|
//!
|
|
//! // Build 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());
|
|
//! ```
|
|
|
|
// Note: #![forbid(unsafe_code)] is intentionally absent because the `tch`
|
|
// dependency (PyTorch Rust bindings) internally requires unsafe code via FFI.
|
|
// All *this* crate's code is written without unsafe blocks.
|
|
#![warn(missing_docs)]
|
|
|
|
pub mod config;
|
|
pub mod dataset;
|
|
pub mod domain;
|
|
pub mod error;
|
|
pub mod eval;
|
|
pub mod geometry;
|
|
pub mod rapid_adapt;
|
|
pub mod ruview_metrics;
|
|
pub mod subcarrier;
|
|
pub mod virtual_aug;
|
|
|
|
// The following modules use `tch` (PyTorch Rust bindings) for GPU-accelerated
|
|
// training and are only compiled when the `tch-backend` feature is enabled.
|
|
// Without the feature the crate still provides the dataset / config / subcarrier
|
|
// APIs needed for data preprocessing and proof verification.
|
|
#[cfg(feature = "tch-backend")]
|
|
pub mod losses;
|
|
#[cfg(feature = "tch-backend")]
|
|
pub mod metrics;
|
|
#[cfg(feature = "tch-backend")]
|
|
pub mod model;
|
|
#[cfg(feature = "tch-backend")]
|
|
pub mod proof;
|
|
#[cfg(feature = "tch-backend")]
|
|
pub mod trainer;
|
|
|
|
// Convenient re-exports at the crate root.
|
|
pub use config::TrainingConfig;
|
|
pub use dataset::{CsiDataset, CsiSample, DataLoader, MmFiDataset, SyntheticCsiDataset, SyntheticConfig};
|
|
pub use error::{ConfigError, DatasetError, SubcarrierError, TrainError};
|
|
// TrainResult<T> is the generic Result alias from error.rs; the concrete
|
|
// TrainResult struct from trainer.rs is accessed via trainer::TrainResult.
|
|
pub use error::TrainResult as TrainResultAlias;
|
|
pub use subcarrier::{compute_interp_weights, interpolate_subcarriers, select_subcarriers_by_variance};
|
|
|
|
// MERIDIAN (ADR-027) re-exports.
|
|
pub use domain::{
|
|
AdversarialSchedule, DomainClassifier, DomainFactorizer, GradientReversalLayer,
|
|
};
|
|
pub use eval::CrossDomainEvaluator;
|
|
pub use geometry::{FilmLayer, FourierPositionalEncoding, GeometryEncoder, MeridianGeometryConfig};
|
|
pub use rapid_adapt::{AdaptError, AdaptationLoss, AdaptationResult, RapidAdaptation};
|
|
pub use virtual_aug::VirtualDomainAugmentor;
|
|
|
|
/// Crate version string.
|
|
pub const VERSION: &str = env!("CARGO_PKG_VERSION");
|