The Problem
Deploying Wi‑Fi‑based human‑pose estimation in production requires a pipeline that can ingest raw CSI data, run high‑throughput signal processing, expose a low‑latency API, and optionally stream results to a web UI. Existing research prototypes are single‑language and lack containerisation, CI, or robust error handling, making them fragile for on‑prem or edge deployments.
What This Does
The repo ships five self‑contained projects that together cover the full stack:
v1/– a Python FastAPI service (v1/src/services/pose_service.py) that wraps the original CSI‑processing code, adds authentication, rate‑limiting, and WebSocket streaming (v1/src/api/websocket/connection_manager.py).rust-port/– a high‑performance Rust implementation (rust-port/wifi-densepose-rs/crates/wifi-densepose-cli/src/main.rs) that reproduces the signal pipeline with µ‑second latency and provides a CLI (wifi-densepose-cli) and a library (wifi-densepose-api).ui/– a React front‑end (e.g.,ui/components/LiveDemoTab.js) that connects to the WebSocket endpoint and renders pose skeletons in the browser.references/– minimal demo scripts (references/app.js,references/index.html) that launch the FastAPI server and the UI together for quick validation..claude/– a collection of analysis agents and documentation assets; not part of the runtime but useful for internal research.
Common techniques include CSI preprocessing, phase unwrapping, feature extraction, and deep‑learning inference (Python) or deterministic signal math (Rust). The Rust port re‑exports the same public API, so the Python service can optionally load the compiled library via ctypes (not shown in the tree but referenced in v1/src/services/pose_service.py).
How It Is Wired
Execution begins at the entry point you invoke:
- Rust CLI –
cargo run --releaseinrust-port/wifi-densepose-rs.main.rsparses CLI args, callswifi_densepose_cli::run(), which forwards towifi_densepose_api::process_csi()(defined inlib.rs). The API crate exposesprocess_csi,extract_features, anddetect_pose. Tests (rust-port/wifi-densepose-rs/crates/wifi-densepose-cli/tests/) verify each stage.
- Python FastAPI –
uvicorn v1.src.main:app --host 0.0.0.0 --port 8000(theappobject is created inv1/src/main.py). Incoming HTTP requests hit the router defined inv1/src/api/routers/pose.py, which callspose_service.process()inv1/src/services/pose_service.py. That function either invokes the pure‑Python pipeline (v1/src/services/signal.py) or loads the Rust library viactypes.CDLLand callsprocess_csi. The WebSocket manager (v1/src/api/websocket/connection_manager.py) broadcasts pose frames to any client that openedws://…/ws/pose.
- React UI –
ui/app(bundled by the Dockerfile) opens a WebSocket to/ws/pose. Incoming JSON frames are handed toui/services/pose.service(most‑connected module) which updates theLiveDemoTabcanvas. The UI does not perform signal work; it only visualises the stream.
The internal call graph shows a clear funnel: ui/app → ui/services/websocket.service → FastAPI → pose_service → (Rust lib). The most connected module is ui/services/pose.service (5 incoming, 3 outgoing imports). No circular dependencies were detected, keeping the blast radius limited to these hubs.
How To Use It
# Clone the repository (preserve the exact URL)
git clone https://github.com/moses-y/wifi-densepose.git
cd wifi-densepose
# Build and run the Rust CLI (quick sanity check)
cd rust-port/wifi-densepose-rs
cargo build --release
cargo test --workspace # 107 tests, 100% coverage reported
cargo run --release -- --input samples/csi.bin # example CLI usage
# Start the Python service in a container (Dockerfile present)
docker build -t wifi-densepose .
docker run -p 8000:8000 wifi-densepose # launches FastAPI + WebSocket
# In a separate terminal, launch the demo UI
docker exec -it $(docker ps -qf "ancestor=wifi-densepose") npm start # runs UI from /ui
# Open http://localhost:3000 (or the port exposed by the UI) to see live pose overlay.
Configuration – The FastAPI service reads PYTHONPATH and optional RUST_LIB_PATH environment variables (set automatically by the Dockerfile). No secret files are required for a local run; production deployment must supply the secrets referenced in .github/workflows/cd.yml (e.g., KUBE_CONFIG_DATA).
Real‑World Use
A warehouse operator could deploy the Docker image on an edge gateway. The gateway streams CSI from commodity mesh routers to the FastAPI service, which forwards pose updates over WebSocket to a monitoring dashboard (the React UI). An alert pipeline could subscribe to the same WebSocket, detect falls via the pose_service.detect_fall() helper, and push notifications to Slack (the Slack webhook URL is stored as a secret in the CI workflow).
# Example: subscribe to pose stream and trigger an alert
import websockets, json, os
async def monitor():
async with websockets.connect("ws://gateway:8000/ws/pose") as ws:
async for msg in ws:
data = json.loads(msg)
if data["fall"]:
# POST to Slack (secret injected at runtime)
await aiohttp.post(os.getenv("SLACK_WEBHOOK_URL"), json={"text": "Fall detected"})
Code Health & Issues
- Critical – Secrets (
KUBE_CONFIG_DATA,SLACK_WEBHOOK_URL) are stored in.github/workflows/cd.yml; a malicious PR could exfiltrate them. Fix: move secret‑using steps to aworkflow_runjob or require reviewer approval. - High – GitHub Actions are not pinned to commit SHAs; tag drift could expose the same secrets. Fix: replace
@vNwith full SHA. - High – No lockfile for Python (
pyproject.tomlwithoutpoetry.lock/requirements.txtlock). Fix: generate and commit the lockfile. - High –
continue-on-erroron correctness steps in CI (.github/workflows/ci.yml). Fix: remove or isolate advisory steps. - Medium – Broad exception handling in several Python modules (
v1/src/api/websocket/connection_manager.py, etc.). Fix: catch specific exceptions and log others. - Medium – Empty
catch {}in.claude/helpers/metrics-db.mjs. Fix: log or rethrow. - Medium – Oversized UI components (
ui/components/LiveDemoTab.js,PoseDetectionCanvas.js,SettingsPanel.js). Fix: split into smaller, responsibility‑focused modules. - Medium – Unpinned Docker base image (
python:3.11-slim). Fix: use digest. - Low – No job timeouts in CI workflows; could cause overlapping runs. Fix: add
timeout-minutes. - Low – Repository lacks formatting conventions (
.editorconfig, etc.). Fix: add standard config files.
The Bottom Line
The repo delivers a complete, containerised stack for Wi‑Fi‑based dense pose estimation, with a high‑performance Rust core and a Python API that can be extended or replaced. Production readiness is hampered by serious secret‑handling lapses and several maintainability issues (deep nesting, duplicated helpers, oversized UI files). Teams that need a proven Wi‑Fi pose pipeline can adopt the Rust core quickly, but must address the highlighted security and hygiene problems before exposing the system in a live environment.