A simple implementation of CSI-based collaborative sensing with two receivers. This is also the open-source version of our WCNC paper - RSSI-Assisted CSI-Based Passenger Counting with Multiple Wi-Fi Receivers. Several useful CSI data collection configuration shell scripts are also included in this repo. To collect CSI data from two devices simultaneously, you can install iTerm2 terminal emulator and use shift+cmd+i (Mac command) to allow broadcast input to all panes in all tabs.
File | Function | Device for Executing |
---|---|---|
generate_traffic.sh |
Generate Ping Flow | PC/Laptop/Edge device |
csiparam_config.sh |
Configure CSI Collection Parameters | CSI receiver (e.g. Pi 4B) |
csi_forward.sh |
Setup CSI data forwarding rule | CSI receiver (e.g. Pi 4B) |
packetcap_pc.sh |
CSI Data Collection | PC/Laptop/Edge device |
infer_model.py |
Online Test with Probability Average | PC/Laptop/Edge device |
613_end_mos4.pth |
Pretrained model pth for receiver A | PC/Laptop/Edge device |
613_head_mos4.pth |
Pretrained model pth for receiver B | PC/Laptop/Edge device |
memory_bank_construction.py |
Memory Bank Construction | PC/Laptop/Edge device |
online_data_collect_test.py |
Online Data Collection and Testing with Memory Bank | PC/Laptop/Edge device |
Run generate_traffic.sh to generate ping flow from router
example - generate ping flow with 1000 Hz:
. generate_traffic.sh 1000 192.168.0.1
Run csiparam_config.sh to configure CSI data collecion parameters
example - collect CSI data derived from Wi-Fi signal in 36 channel with 80 MHz bandwidth and generated by a router with MAC address aa:bb:cc:dd:ee:ff:
. csiparam_config.sh 36 80 aa:bb:cc:dd:ee:ff
Run csi_forward.sh to setup CSI data forwarding rule
example - forward CSI data from device with IP address 192.168.3.11 to device with IP address 192.168.3.12:
sudo bash csi_forward.sh 192.168.3.11 192.168.3.12
Run packetcap_pc.sh to collect CSI data from a certain device and save them into a certain folder
example - collect CSI data under 0-1 people scenarios from a device with IP address 192.168.3.11 and save them into folder name "test". Each scenario will collect 500 pcap files with each of them include 1000 packets:
. packetcap_pc.sh test 0 1 1 500 1000 192.168.3.11
Run infer_model.py to start online test with probability average using two pre-trained models. Pytorch environment is needed. Note that you need to modify IP_ADDRESS and ACCESS_TOKEN parameters to your own. You may also customize NUM_FILES, and PASSENGER parameters to fit your own setting.
python infer_model.py
Run memory_bank_construction.py to start memory bank construction.
example - construct memory bank for date collected from Feb 7th using the backbone pretrained on data collected from Jan. 9th:
python memory_bank_construction.py --pretrain_date 19 --train_date 27 --test_date 27 --aug lp_sg_1000 --num_class 11 --num_test_class 11 --use_knn --status both --k 25 --bank_type "memory" --long_duration_pred --diff_pos --idx 0 1 2
Run online_data_collect_test.py to start online data collection and testing with memory bank.
example - collect data for April 8th and test with memory bank constructed from data collected from Feb 7th:
python online_data_collect_test.py --num_class 15 --pretrained_date 27 --passenger 4 --predict_tolerance 3 --save_date 48 --status rm --pretrained_status mm --predict_duration 4 --num_train_times 7 --beta 0.16 --temp 0.1 --haddr 192.168.1.92 --eaddr 192.168.1.24 --k 25 --aug lp_sg_1000 --single_load
Run online_test.py to start online data collection and testing with memory bank.
example - testing in April 8th with memory bank constructed from data collected from April 8th:
python online_test.py --num_class 15 --pretrained_date 48 --passenger 4 --save_date 48 --status rm --pretrained_status mm --predict_duration 4 --threshold 0.1 --temp 0.1 --haddr 192.168.1.92 --eaddr 192.168.1.24 --k 25 --aug lp_sg_1000 --single_load