How retsediv/wifi_csi_based_har works
Project Type & Purpose
• This is a research-oriented full-pipeline system:
• Embedded C code on two routers: one sends packets, the other extracts CSI and forwards them.
• A Python/Qt “data_retrieval” service that listens over UDP, visualizes, and persists raw CSI.
• A Python “model” package that calibrates data, labels activities, builds datasets, trains deep models (LSTM, InceptionTime, etc.), runs experiments, and provides EDA notebooks.
High-Level Components
• Hardware Layer
• Router A (sendData.c)
• Router B (recvCSI + csi_fun.c/h)
• Networking
• UDP link from Router B → Data Retrieval Server
• Data Retrieval & Storage
• Python server (run_visualization_server.py)
• Test client (run_test_client.py) for emulation
• Raw CSI files in data_retrieval/data/
• Preprocessing & Calibration
• data_retrieval/csi_extraction module: calibration, parsing, log reading
• Labeling
• model/label_activities.py (activity labels)
• Dataset & Metrics
• model/dataset.py (dataset abstraction)
• model/metrics.py (evaluation metrics)
• Model Training & Experiments
• Model definitions in model/models/*.py (FCN, LSTM, InceptionTime)
• Training scripts (model/train_lstm.py, model/main.py)
• Learning rate schedulers (model/schedulers)
• Experiment directories (model/experiments/1x1_vs_2x2)
• Visualization & Analysis
• Jupyter notebooks in model/notebooks for EDA and result visualization
• External Dependencies
• Wi-Fi CSI Atheros user-space tool (fork)
• PyTorch, fastai, torchtimeseries, Qt (for UI), NumPy/Pandas/Matplotlib
Relationships & Data Flow
1. Router A sends data packets over Wi-Fi → Router B.
2. Router B runs recvCSI C code → extracts CSI → wraps into binary UDP payloads → sends to PC.
3. On the PC, run_visualization_server.py listens on UDP port → decodes streams with csi_extraction → optionally displays UI (window.ui) → writes raw CSI to disk.
4. Offline, Python scripts load raw CSI files → run calibration (csi_calibration.py) → label events with YOLO model on video frames → produce a cleaned, labeled dataset.
5. Dataset feeds into deep learning pipeline: instantiate models → train with schedulers → evaluate with metrics.py → store results under model/experiments.
6. Notebooks consume experiment artifacts for plotting and EDA.
Architectural Patterns & Principles
• Layered, modular pipeline:
Hardware → Data Ingestion → Preprocessing → Labeling → Modeling → Visualization
• Separation of Concerns: embedded C for CSI capture; Python service for ingestion; pure-Python ML for training & analysis.
• Extensibility points:
• New models can be dropped into model/models/
• New schedulers in model/schedulers/
• New labeling methods via additional scripts