An attempt at a cost-effective and realtime human activity recognition solution capable of running on a Raspberry Pi Zero using Wi-Fi CSI data acquired from an ESP32 Wi-Fi module/devkit.
Two ESP32s - one for CSI broadcasting and the other for receiving is to be flashed with the official ESP-CSI SDK. The exact version of the SDK used is available here.
Tested on: ESP32-WROOM-32
- Install runtime requirements
pip3 install -r requires/runtime.txt
- Download dataset
./scripts/download_dataset.sh
./scripts/genmat.py --recipe ./dataset/recipes.yaml
For generating/training on a custom dataset, checkout the project wiki.
- Train parameters1
python3 train.py --main-set ./dataset/rCSI-d1d2.mat --hold-set ./dataset/rCSI-d3.mat --train-size 0.8 --dump artifacts/v1
./scripts/populate_csififo.sh -d /dev/ttyUSB0 -b 921600 -n /tmp/csififo -s 235 -p 0644 -u 1000
- Run HAR3
python3 main.py --load artifacts/v1 --host 127.0.0.1 --port 9999 --frequency 2
pip3 install -r requires/ui.txt
python3 ui.py --host 127.0.0.1 --port 9999
Footnotes
-
Training starts with a train-test split on the
main-set
as pertrain-size
. The model is tested on the test split as well as ahold-set
. The hold-set should ideally have CSI data captured on a different day and/or by different volunteers to see how well the model has generalised ↩ -
Creates a log file
/tmp/csififo
with 235k buffer size (holds ~256 CSI records) owned by user with UID == 1000 and file permissions 0644 . Reads serial device/dev/ttyUSB0
at baud 921600 and populates/tmp/csififo
↩ -
Loads parameters from
artifacts/v1
and broadcasts predictions using a websocket server serving at 127.0.0.1:9999 at a frequency of 2 Hz ↩