/mowa-wifi-sensing

Wi-Fi sensing model of MOWA

Primary LanguagePythonBSD 3-Clause "New" or "Revised" LicenseBSD-3-Clause

mowa-wifi-sensing

The mowa-wifi-sensing module performs real-time Wi-Fi CSI-based human activity recognition. CSI collected from the Nexmon extractor is delivered to the server using socket communication, and the server uses window-size-CSI-data as an input value for the trained activity classification model.

β€» Notice β€»
The current version supports both supervised learning and meta-learning.

README Korean version

πŸ‡°πŸ‡· README.md in Korean

Activity Classes

  • Empty (default)
  • Fall
  • Sit
  • Stand
  • Walk

Getting Started

Clone this repository on CSI extractor and server:

git clone https://github.com/oss-inc/mowa-wifi-sensing.git

1. Server

Computing environment

  • Ubuntu 20.04
  • Intel(R) i9-9900KF
  • GeForce RTX 2080 Ti 11GB
  • Python 3.8

Installation


  1. Move to server directory
cd server
  1. Install the required dependencies:
pip install -r requirements.txt
  1. Place the downloaded dataset and pre-trained models as follows:
server
   |β€”β€”β€”β€”β€”β€”csi_dataset
   |        β””β€”β€”β€”β€”β€”β€”domain_A
   |        |       β””β€”β€”β€”β€”β€”β€”empty.csv
   |        |       β””β€”β€”β€”β€”β€”β€”sit.csv
   |        |       β””β€”β€”β€”β€”β€”β€”stand.csv
   |        |       β””β€”β€”β€”β€”β€”β€”walk.csv
   |        |       β””β€”β€”β€”β€”β€”β€”fall.csv
   |        β””β€”β€”β€”β€”β€”β€”domain_B
   |        β””β€”β€”β€”β€”β€”β€”realtime
   |
   |β€”β€”β€”β€”β€”β€”checkpoint
   |        β””β€”β€”β€”β€”β€”β€”svl_vit
   |        |       β””β€”β€”β€”β€”β€”β€”svl_best_model.pt
   |        β””β€”β€”β€”β€”β€”β€”few_vit
   |                β””β€”β€”β€”β€”β€”β€”fsl_best_model.pt
   |β€”β€”β€”β€”β€”β€”dataloader
   |β€”β€”β€”β€”β€”β€”model
   |β€”β€”β€”β€”β€”β€”plot
   β””β€”β€”β€”β€”β€”β€”runner
  1. In the realtime folder, new data collected from a different domain is stored.
    • This data is used for generating prototypes using a model trained through meta-learning.
    • Therefore, it only requires few-shot data, and having enough to create a support set for each class is sufficient.
    • For demo, you can insert either domain_A or domain_B data to run it.

Usage


  1. You can customize the server and client configurations by modifying the config.yaml file.

Example:

# Server
server_ip: 'xxx.xxx.xxx.xxx'
server_port: xxxx

# Client
client_mac_address: 'xxxxxxxxx'
  1. Running socket server for real-time activity recognition:
# Use supervised learning based model
python run_SVL.py
# Use meta-learning(few-shot learning) based model
python run_FSL.py

Using customized model

  1. After collecting CSI data, prepare a csv file for each activity according to the above directory structure.(If you want to easily extract the .csv file by activity class from the .pcap file, use extract_activity.py in this repository.)

  2. Model train:

# Supervised learning
python main.py --learning SVL --mode train
# Meta-learning
python main.py --learning FSL --mode train
  1. Model evaluation:
# Supervised learning
python main.py --learning SVL --mode test
# Meta-learning
python main.py --learning FSL --mode test

2. Extractor

This module is based on CSI extracted with Nexmon CSI Extractor(Raspberry Pi, Wi-Fi chip: bcm43455c0). Therefore, the Nexmon CSI extractor installation must be preceded.

β€» Notice β€»
Additional WLAN cards must be installed for socket communication.

Installation

  1. Move to extractor directory
cd extractor
  1. Install the required dependencies:
pip3 install -r requirements.txt

Usage

  1. Modify the HOST and PORT values at the top to match the server information in client.py.

  2. Running socket client for real-time CSI transmission

python3 client.py

Referenced Projects

This project takes inspiration from the following open-source project:

  • Nexmon: The Nexmon project provides firmware patches for collecting CSI on Broadcom Wi-Fi chips. For more information about this project, please visit the Nexmon GitHub repository.