wifi-view —— 由 Vikkyv9/wifi-view 镜像的 RuView WiFi 感知 (WiFi sensing) 对比学习编码器,
把 ESP32 采集的 8 维 CSI (Channel State Information) 特征编码为 128 维 L2 归一化嵌入,
并附带 presence-head(有人存在判定)与 node-1/node-2 房间 LoRA 适配器。
本仓库内容:在昇腾 NPU 上完成 Vikkyv9/wifi-view 的模型适配与服务化推理适配,
含推理脚本、服务化脚本、部署说明、环境依赖清单与截图素材目录。
Enc(8 → 64 → 128,BatchNorm + GELU → L2 normalize,9,280 参数)| 组件 | 版本 |
|---|---|
| torch | 2.9.0 |
| torch_npu | 2.9.0.post1 |
| CANN | 8.5.1 |
| Python | 3.11.14 |
| NPU | Ascend 910 |
wifi-view 为“其他”类 WiFi感知嵌入模型,不属 vLLM 模型 registry,因此采用
torch_npu 原生路径自建 OpenAI 风格服务,而非 vLLM-Ascend。
两个真实权重门禁均通过(NPU 上实测):
csi-embed-v2.safetensors(练好的 8→64→128 encoder)随机输入前向,
输出形状 (1,128) 且 L2 len≈1.0,无 NaN/Inf;训练标准化统计(FEATURE_MEAN / FEATURE_STD)取自
csi-embed-v2.py。 ⚠️ 原仓model.safetensors头部 JSON 损坏(trailing chars),不能用 safetensors 载入, 统一使用打好的csi-embed-v2.safetensors。
wifi-view/
├── inference.py # 推理脚本(必选)
├── serve.py # 服务化推理(FastAPI, /v1/models, /v1/embeddings, /v1/presence)
├── README.md # 部署说明文档(必选)
├── requirements.txt # 环境依赖清单(必选)
├── weights/ # 权重文件(csi-embed-v2.safetensors / presence-head.json / node-*.json)
└── assets/ # 截图素材文件夹(必选)
├── agent_workflow.png
├── npu_device_call.png
└── model_result.png# 1) 安装依赖
pip install -r requirements.txt
# 2) 权重 (已随仓放置于 weights/;也可从 hf 镜像拉取后替换)
# csi-embed-v2.safetensors --8->64->128 encoder (~40KB)
# presence-head.json -- presence 权值
# node-1.json / node-2.json -- 房间 rank-4 LoRA
# 3) 单次推理 (NPU)
python3 inference.py --feature "0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8" --device npu:0
python3 inference.py --input feats.csv --device npu:0
python3 inference.py --feature "..." --node node-1 --device npu:0 # 附 LoRA 房间适配
# 4) 服务化推理
python3 serve.py # 默认 0.0.0.0:8000, 可用 --port --device 覆盖curl http://127.0.0.1:8000/v1/models
curl -X POST http://127.0.0.1:8000/v1/embeddings \
-H 'Content-Type: application/json' \
-d '{"input":[[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8]]}'
# 带房间适配
curl -X POST http://127.0.0.1:8000/v1/embeddings \
-H 'Content-Type: application/json' \
-d '{"input":[[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8]],"node":"node-1"}'
# presence
curl -X POST http://127.0.0.1:8000/v1/presence \
-H 'Content-Type: application/json' \
-d '{"input":[[0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8]]}'响应示例:
{"object":"list","model":"Vikkyv9/wifi-view","data":[{"object":"embedding","index":0,
"embedding":[0.1093,-0.0242,-0.0404,...128-dim...]}]}
{"presence":[0.9998]}| 阶段 | 指标 | 数值 |
|---|---|---|
| 编码 | Encoder (8→128, 单帧) | <1ms |
| presence | 头前向 | <1ms |
见 assets/(agent_workflow.png / npu_device_call.png / model_result.png),
验证完成后替换。
贡献者: 适配者 | 赛道: 模型适配赛道 | 硬件: NPU