NPU-adapted inference for aarongid/wifi-densepose-pretrained
— a self-supervised WiFi-sensing (RuView/DensePose-style) model that encodes an
8-dim Channel State Information (CSI) feature vector into a 128-dim L2-normalized
embedding. Same sona-lora CSI-encoder-8-64-128 architecture as wifi-view.
The model is executed on an Ascend NPU via torch-npu. No CUDA is used anywhere.
| Item | Value |
|---|---|
| Task | WiFi CSI → 128-dim sensing embedding |
| Network | Linear(8,64) → BN+GELU → Linear(64,128) → BN → L2-normalize |
| Params | 9,280 |
| Input | 8-dim CSI feature vector (presence, motion, breathing, HR, ...) |
| Device | npu:0 (Ascend), CPU fallback |
Weights are cached in ./model_weights/wifi-densepose-pretrained (auto-downloaded
on first run from the hf-mirror.com mirror if the cache is missing):
mkdir -p model_weights/wifi-densepose-pretrained
HF_ENDPOINT=https://hf-mirror.com python3 -m huggingface_hub.snapshot_download \
aarongid/wifi-densepose-pretrained --local-dir model_weights/wifi-densepose-pretrainedinference.py loads the local cache first (csi-embed-v2.safetensors) and only
downloads when the cache is absent.
Weights are git-ignored; only code and
assets/are published.
python3 inference.py --img sample_features.txtThe --img argument accepts an 8-dim CSI feature file: .txt, .csv, .npy,
.npz or .json (e.g. {"features": [...]}).
Example output:
{
"model": "wifi-densepose-pretrained",
"device": "npu:0",
"embedding_dim": 128,
"embedding_norm": 1.0,
"embedding": [0.0412, -0.0857, ...]
}Serve the model over HTTP:
python3 inference.py --serve --port 8000Health check:
curl http://127.0.0.1:8000/health
# {"status":"ok","model":"wifi-densepose-pretrained","device":"npu:0"}Prediction (upload a feature file):
curl -X POST http://127.0.0.1:8000/predict -F "file=@sample_features.txt"Returns the same JSON result as the CLI.
npu:0; NPU init is wrapped in try-except with a CPU fallback.cuda (case-insensitive) in the project code..
├── inference.py # dual-mode NPU inference (CLI + FastAPI)
├── sample_features.txt # sample input (8-dim CSI feature vector)
├── sample_features.json
├── README.md
├── assets/ # 3 screenshots (NPU workflow / CLI / web)
└── model_weights/ # git-ignored weight cache
└── wifi-densepose-pretrained/{csi-embed-v2.safetensors, config.json, ...}