This repository contains the CSI-embed-v2 encoder, a lightweight neural network that converts raw WiFi Channel State Information (CSI) features into fixed-size embedding vectors. The model is adapted for deployment on Huawei Ascend NPU using the torch_npu backend.
WiFi signals reflect off objects and people in an environment. By analyzing how these signals change over time, it is possible to detect human presence, track movement, and even estimate vital signs like breathing and heart rate. This model is the core encoder component of the RuView sensing pipeline.
The encoder architecture is a simple feed-forward network with an 8-dimensional input and a 128-dimensional L2-normalized output, trained using a contrastive (InfoNCE) loss.
| Component | Version |
|---|---|
| Operating System | Linux (aarch64) |
| NPU Hardware | Ascend 910B (9362) |
| Python | 3.11.14 |
| torch | 2.9.0 |
| torch_npu | 2.9.0.post1 |
| vLLM-Ascend | 0.18.0 |
| Ascend CANN | 8.5.1 |
| npu-smi | 25.5.5 |
pip install torch torch_npu safetensors numpy fastapi uvicorn pydantic requestscd /path/to/model
python3 inference.py --serve --port 8001The server will load the model weights onto NPU device 0 and listen for HTTP requests.
curl http://127.0.0.1:8001/health
# Expected: {"status":"ok","device":"npu:0"}Run a quick verification against the running service:
python3 inference.py --smoke http://127.0.0.1:8001Or manually:
curl -X POST http://127.0.0.1:8001/predict \
-H "Content-Type: application/json" \
-d '{"features": [[0.12, -0.34, 0.56, -0.78, 0.90, -0.11, 0.22, -0.33]]}'The response should contain an embedding array of shape [1, 128] with a norm of approximately 1.0.
Benchmark results measured on Ascend 910B (single chip, NPU 6):
| Batch Size | Latency (ms) | Throughput (samples/s) |
|---|---|---|
| 1 | 5.6 | 178 |
| 4 | 3.2 | 1250 |
| 16 | 2.8 | 5714 |
| 64 | 2.5 | 25600 |
The model is extremely lightweight (9,666 parameters, ~39 KB), making it suitable for real-time edge deployment scenarios.
The encoder was trained on 610,615 CSI triplets across 60,630 temporal frames. Key metrics:
The accuracy metric is computed on a time-disjoint split, ensuring that training and evaluation frames do not overlap temporally. This is a stricter evaluation than random splitting and provides a more realistic estimate of generalization performance.
assets/ directory for edge deployments on resource-constrained devices.Vikkyv9/wifi-view.