Vikkyv9/wifi-view(RuView WiFi Sensing Model)是一个面向 WiFi 感知(WiFi CSI
sensing)的对比学习嵌入编码器。它将 ESP32 等设备采集到的 8 维标准化 CSI 特征向量
映射为 128 维 L2 归一化嵌入向量,用于存在性检测(presence detection)、运动分类、
呼吸/心率等生命体征感知等下游任务。
csi-encoder-8-64-128,2 层全连接(8 -> 64 -> 128),BatchNorm + GELU,
输出 L2 归一化嵌入。csi-embed-v2.safetensors(v2 正确收敛版本,InfoNCE 训练)。presence-head.json(128 维线性存在性检测头)、node-1/2.json(房间 LoRA 适配器)。本适配使用真实权重在单卡 Ascend910B(Ascend910_9362)上完成 NPU 推理验证。
| 项目 | 值 |
|---|---|
| NPU | Ascend910_9362(npu-smi 显示 Ascend910,HBM 64 GB) |
| CANN / npu-smi | 25.5.5 |
| torch | 2.9.0+cpu |
| torch_npu | 2.9.0.post1+gitee7ba04 |
| Python | 3.11.14 |
| 权重 | csi-embed-v2.safetensors(FP32) |
| 设备 | npu:0 |
torch.npu.is_available(): True
device name: Ascend910_9362
model param device: npu:0
model param dtype: torch.float32pip install -r requirements.txt
# torch、torch-npu、safetensors、huggingface_hub# 默认执行:自动加载本地权重(缺失时从 hf-mirror 下载)并在 npu:0 推理
python inference.py
# 显式指定权重目录
python inference.py --model-dir /path/to/model_weights脚本默认执行真实 NPU 推理,打印模型信息、三个固定 CSI 样本的 128 维嵌入、
存在性检测分数、CPU-NPU 一致性检查与性能测试,并输出 RESULT: PASS/FAIL。
固定输入(8 维 CSI 特征,语义见模型卡:presence/motion/breathing/heart-rate/phase-variance/person-count/fall/rssi):
| 样本 | embedding shape | L2 范数 | presence logit | presence prob |
|---|---|---|---|---|
present_moving | [1, 128] | 1.0 | 8.0774 | 0.99969 |
present_still | [1, 128] | 1.0 | 8.1866 | 0.99972 |
absent | [1, 128] | 1.0 | 7.9435 | 0.99965 |
嵌入相似度矩阵(NPU 输出,固定样本):
| cosine | present_moving | present_still | absent |
|---|---|---|---|
| present_moving | 1.0 | 0.7827 | 0.7668 |
| present_still | 0.7827 | 1.0 | 0.8770 |
| absent | 0.7668 | 0.8770 | 1.0 |
说明:以上为固定 3 样本的 smoke consistency 验证(展示真实 NPU 推理输出), 不是完整数据集评测;presence 分数顺序 present > absent,符合预期。
相同权重、相同固定输入分别运行 CPU 与 NPU:
| 检查项 | 结果 |
|---|---|
| CPU-NPU embedding cosine(最小) | 1.0(阈值 ≥ 0.999)✅ |
| L2 归一化 | 1.0 ✅ |
| presence 排序 present > absent | 通过 ✅ |
npu:0,batch size 1,dtype FP32,torch.npu.synchronize() 计时,预热 5 次、正式测试 20 次:
| 指标 | 值 |
|---|---|
| 平均延迟 | 0.2466 ms |
| 最小 / 最大延迟 | 0.2402 / 0.2752 ms |
| p50 / p90 / p95 | 0.2434 / 0.2651 / 0.2752 ms |
| 吞吐量 | 约 4055 emb/s |
| 峰值显存 | 0.048 MB |
assets/agent_workflow.png:下载、侦察、环境检查、NPU 推理、验证、性能的完整工作流日志。assets/npu_device_call.png:npu-smi、torch.npu.is_available()、设备名、模型参数所在设备。assets/model_result.png:默认 python inference.py 的真实输出与 RESULT: PASS。presence-head.json 的 bias 较大,presence 概率整体偏高,适合作为方向性参考而非精确判定。model-q2/q4/q8.bin、csi-embed-v2-int4.bin)面向 ESP32 边缘推理,本适配使用 FP32 权重。HF_ENDPOINT=https://hf-mirror.com)。NPU、Ascend、Ascend910、wifi-sensing、CSI、embedding、edge-ai、Hardware: NPU