Skip to content

winwinashwin/CSI-Sense-Zero

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CSI Sense Zero

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.

Approach based on ideas from LiteHAR and Rocket.


system architecture


Getting Started

Configuring ESPs

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

Training Model Parameters

  • 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

Configuring the Pi

  • Follow Pi specific setups here

  • Log CSI data to FIFO2

./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

Minimal UI for Visualisation

pip3 install -r requires/ui.txt
python3 ui.py --host 127.0.0.1 --port 9999

Footnotes

  1. Training starts with a train-test split on the main-set as per train-size. The model is tested on the test split as well as a hold-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

  2. 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

  3. 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