Major changes: - Organized Python v1 implementation into v1/ subdirectory - Created Rust workspace with 9 modular crates: - wifi-densepose-core: Core types, traits, errors - wifi-densepose-signal: CSI processing, phase sanitization, FFT - wifi-densepose-nn: Neural network inference (ONNX/Candle/tch) - wifi-densepose-api: Axum-based REST/WebSocket API - wifi-densepose-db: SQLx database layer - wifi-densepose-config: Configuration management - wifi-densepose-hardware: Hardware abstraction - wifi-densepose-wasm: WebAssembly bindings - wifi-densepose-cli: Command-line interface Documentation: - ADR-001: Workspace structure - ADR-002: Signal processing library selection - ADR-003: Neural network inference strategy - DDD domain model with bounded contexts Testing: - 69 tests passing across all crates - Signal processing: 45 tests - Neural networks: 21 tests - Core: 3 doc tests Performance targets: - 10x faster CSI processing (~0.5ms vs ~5ms) - 5x lower memory usage (~100MB vs ~500MB) - WASM support for browser deployment
41 lines
1.3 KiB
Markdown
41 lines
1.3 KiB
Markdown
# ADR-002: Signal Processing Library Selection
|
|
|
|
## Status
|
|
Accepted
|
|
|
|
## Context
|
|
CSI signal processing requires FFT operations, complex number handling, and matrix operations. We need to select appropriate Rust libraries that provide Python/NumPy equivalent functionality.
|
|
|
|
## Decision
|
|
We will use the following libraries:
|
|
|
|
| Library | Purpose | Python Equivalent |
|
|
|---------|---------|-------------------|
|
|
| `ndarray` | N-dimensional arrays | NumPy |
|
|
| `rustfft` | FFT operations | numpy.fft |
|
|
| `num-complex` | Complex numbers | complex |
|
|
| `num-traits` | Numeric traits | - |
|
|
|
|
### Key Implementations
|
|
|
|
1. **Phase Sanitization**: Multiple unwrapping methods (Standard, Custom, Itoh, Quality-Guided)
|
|
2. **CSI Processing**: Amplitude/phase extraction, temporal smoothing, Hamming windowing
|
|
3. **Feature Extraction**: Doppler, PSD, amplitude, phase, correlation features
|
|
4. **Motion Detection**: Variance-based with adaptive thresholds
|
|
|
|
## Consequences
|
|
|
|
### Positive
|
|
- Pure Rust implementation (no FFI overhead)
|
|
- WASM compatible (rustfft is pure Rust)
|
|
- NumPy-like API with ndarray
|
|
- High performance with SIMD optimizations
|
|
|
|
### Negative
|
|
- ndarray-linalg requires BLAS backend for advanced operations
|
|
- Learning curve for ndarray patterns
|
|
|
|
## References
|
|
- [ndarray documentation](https://docs.rs/ndarray)
|
|
- [rustfft documentation](https://docs.rs/rustfft)
|