1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
//! # 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.
/// Metric-locked pose-accuracy harness (ADR-155 §Tier-1.2; needs ADR slot 173)
/// — selectable `PckNormalization` (torso / bbox-diagonal / absolute), `mpjpe`,
/// and a self-describing `PoseAccuracy` result so a reported PCK number always
/// carries the definition it was computed under.
/// Canonical pose-metric core (ADR-155 §Tier-1.1) — `pck_canonical` /
/// `oks_canonical`, available **without** the `tch-backend` feature so the
/// single metric definition is reachable from the workspace test gate.
// 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.
/// ADR-145 — ablation evaluation harness (feature matrix + privacy/latency metrics).
/// Falsifiable occupancy/presence benchmark (real-CSI gate: provenance,
/// leak-free split, bootstrap-CI thresholds; refuses claims on synthetic/mock).
// Convenient re-exports at the crate root.
// Canonical metric (ADR-155 §Tier-1.1) — re-exported un-gated so the single
// source of truth is reachable with or without `tch-backend`.
pub use ;
// ADR-155 §Tier-1.2 — metric-locked accuracy harness (selectable PCK
// normalization + MPJPE + self-describing result).
pub use ;
pub use TrainingConfig;
pub use ;
pub use ;
// TrainResult<T> is the generic Result alias from error.rs; the concrete
// TrainResult struct from trainer.rs is accessed via trainer::TrainResult.
pub use TrainResult as TrainResultAlias;
pub use ;
// ADR-152 §2.3 — UNSW MAE pretraining recipe re-exports.
pub use ;
// ADR-152 §2.2 — WiFlow-STD (DY2434) spatio-temporal-decoupled pose model.
pub use WiFlowStdConfig;
pub use WiFlowStdModel;
// MERIDIAN (ADR-027) re-exports.
pub use ;
pub use CrossDomainEvaluator;
pub use ;
pub use ;
pub use VirtualDomainAugmentor;
/// Crate version string.
pub const VERSION: &str = env!;