r
redannancy/wifi-view
Model Introduction
Files & versions
Pull Requests
Discussion
Analysis

WiFi Sensing CSI Embedding Model

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.

Overview

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.

Verified Environment

ComponentVersion
Operating SystemLinux (aarch64)
NPU HardwareAscend 910B (9362)
Python3.11.14
torch2.9.0
torch_npu2.9.0.post1
vLLM-Ascend0.18.0
Ascend CANN8.5.1
npu-smi25.5.5

Service Startup

Prerequisites

pip install torch torch_npu safetensors numpy fastapi uvicorn pydantic requests

Start the inference server

cd /path/to/model
python3 inference.py --serve --port 8001

The server will load the model weights onto NPU device 0 and listen for HTTP requests.

Verify the server is ready

curl http://127.0.0.1:8001/health
# Expected: {"status":"ok","device":"npu:0"}

Smoke Test

Run a quick verification against the running service:

python3 inference.py --smoke http://127.0.0.1:8001

Or 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.

Performance Reference

Benchmark results measured on Ascend 910B (single chip, NPU 6):

Batch SizeLatency (ms)Throughput (samples/s)
15.6178
43.21250
162.85714
642.525600

The model is extremely lightweight (9,666 parameters, ~39 KB), making it suitable for real-time edge deployment scenarios.

Accuracy Evaluation

The encoder was trained on 610,615 CSI triplets across 60,630 temporal frames. Key metrics:

  • Temporal-triplet accuracy (held-out): 82.3%
  • Raw feature baseline: 66.4% (without encoder)
  • Improvement: +15.9 percentage points
  • L2 normalization consistency: Verified (output norm = 1.0)
  • Deterministic output: Verified (same input produces identical output across runs)

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.

Notes

  • The model input is an 8-dimensional pre-extracted CSI feature vector (standardized z-score).
  • The output is a 128-dimensional L2-normalized embedding vector, suitable for downstream tasks like presence detection, person identification, and clustering.
  • Quantized variants (INT4, Q2, Q4, Q8) are included in the assets/ directory for edge deployments on resource-constrained devices.
  • This model was adapted from the original HuggingFace repository at Vikkyv9/wifi-view.