|
a/README.md |
|
b/README.md |
1 |
# OMNI (Open Source Monitoring of Neonates and Infants) |
1 |
# OMNI (Open Source Monitoring of Neonates and Infants) |
2 |
|
2 |
|
3 |
<p align="center"> |
3 |
|
4 |
<image src = 'images/omni-logo.png' > |
4 |
|
5 |
</p> |
5 |
|
6 |
|
6 |
|
7 |
|
|
|
8 |
|
|
|
9 |
## Software Requirements |
7 |
## Software Requirements
|
10 |
Run `sh requirements.sh` in a virtual environment in order to download the required libraries. |
8 |
Run `sh requirements.sh` in a virtual environment in order to download the required libraries. |
11 |
|
9 |
|
12 |
## Hardware Requirements (Edge implementation) |
10 |
## Hardware Requirements (Edge implementation) |
13 |
|
11 |
|
14 |
 |
12 |

|
15 |
### Components needed: |
13 |
### Components needed: |
16 |
|
14 |
|
17 |
1. [OpenBCI Ganglion kit](https://shop.openbci.com/products/ganglion-board?variant=13461804483) |
15 |
1. [OpenBCI Ganglion kit](https://shop.openbci.com/products/ganglion-board?variant=13461804483)
|
18 |
|
16 |
|
19 |
Open source biosignal acquisition hardware for [research grade biosignal acquisition](https://openbci.com/community/published-research-with-openbci/) |
17 |
Open source biosignal acquisition hardware for [research grade biosignal acquisition](https://openbci.com/community/published-research-with-openbci/)
|
20 |
|
18 |
|
21 |
2. [Raspberry Pi 4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/) |
19 |
2. [Raspberry Pi 4](https://www.raspberrypi.org/products/raspberry-pi-4-model-b/)
|
22 |
3. [Rasberry Pi 4 cooling case](https://www.newegg.com/p/1W8-00Y1-00032) |
20 |
3. [Rasberry Pi 4 cooling case](https://www.newegg.com/p/1W8-00Y1-00032)
|
23 |
4. Shirt using [conductive textile electrodes](https://www.alibaba.com/product-detail/Conductive-textile-ecg-Electrodes_1127697682.html) [1$ for 1 electrode] |
21 |
4. Shirt using [conductive textile electrodes](https://www.alibaba.com/product-detail/Conductive-textile-ecg-Electrodes_1127697682.html) [1$ for 1 electrode]
|
24 |
|
22 |
|
25 |
|
23 |
|
26 |
Wearable ECG electrodes --> OpenBCI Ganglion ---(Bluetooth)---> Raspberry Pi 4 |
24 |
Wearable ECG electrodes --> OpenBCI Ganglion ---(Bluetooth)---> Raspberry Pi 4 |
27 |
|
25 |
|
28 |
## System Configuration |
26 |
## System Configuration
|
29 |
* Ubuntu 16.04 |
27 |
* Ubuntu 16.04
|
30 |
* Nvidia 1080Ti - (Required for training the model) |
28 |
* Nvidia 1080Ti - (Required for training the model) |
31 |
|
29 |
|
32 |
## Train a model to extract R peaks and Heart Rate from ECG waveform. |
30 |
## Train a model to extract R peaks and Heart Rate from ECG waveform.
|
33 |
* Download ECG MITDB monitoring data from https://storage.googleapis.com/mitdb-1.0.0.physionet.org/mit-bih-arrhythmia-database-1.0.0.zip and unzip it. |
31 |
* Download ECG MITDB monitoring data from https://storage.googleapis.com/mitdb-1.0.0.physionet.org/mit-bih-arrhythmia-database-1.0.0.zip and unzip it.
|
34 |
* To train: `python train.py --preprocess_data --data_path "PATH TO DATA"` |
32 |
* To train: `python train.py --preprocess_data --data_path "PATH TO DATA"` |
35 |
|
33 |
|
36 |
## Train a model to extract Breathing Rate from ECG waveform. |
34 |
## Train a model to extract Breathing Rate from ECG waveform.
|
37 |
* Download ECG from the BIDMC database which is derived from MIMIC-II from https://physionet.org/static/published-projects/bidmc/bidmc-ppg-and-respiration-dataset-1.0.0.zip and unzip it. |
35 |
* Download ECG from the BIDMC database which is derived from MIMIC-II from https://physionet.org/static/published-projects/bidmc/bidmc-ppg-and-respiration-dataset-1.0.0.zip and unzip it.
|
38 |
* To train: `python train.py --preprocess_data --data_path "PATH TO DATA"` |
36 |
* To train: `python train.py --preprocess_data --data_path "PATH TO DATA"` |
39 |
|
37 |
|
40 |
## Model Inference |
38 |
## Model Inference
|
41 |
* Download ECG from the preterm infant database from https://physionet.org/static/published-projects/picsdb/preterm-infant-cardio-respiratory-signals-database-1.0.0.zip and unzip it. |
39 |
* Download ECG from the preterm infant database from https://physionet.org/static/published-projects/picsdb/preterm-infant-cardio-respiratory-signals-database-1.0.0.zip and unzip it.
|
42 |
* Download the Heart Rate computation model from here: https://drive.google.com/open?id=1yI7G4nofjuzFWkD1CfsOtLZxaukTu0di |
40 |
* Download the Heart Rate computation model from here: https://drive.google.com/open?id=1yI7G4nofjuzFWkD1CfsOtLZxaukTu0di
|
43 |
* Download the Breathing Rate computation model from here: https://drive.google.com/open?id=1ycV74LfGmgcGmLlrPn2VileeFNsGrRZT |
41 |
* Download the Breathing Rate computation model from here: https://drive.google.com/open?id=1ycV74LfGmgcGmLlrPn2VileeFNsGrRZT
|
44 |
* To run inference and view GUI type: `python run_model.py --path_dir "PATH TO DATA" --saved_hr_model_path "PATH TO HR MODEL" --saved_br_model_path "PATH TO BR MODEL" --patient_no 3 --viewer 1` |
42 |
* To run inference and view GUI type: `python run_model.py --path_dir "PATH TO DATA" --saved_hr_model_path "PATH TO HR MODEL" --saved_br_model_path "PATH TO BR MODEL" --patient_no 3 --viewer 1` |
45 |
|
43 |
|
46 |
# OMNI OpenBCI Pi Inference |
44 |
# OMNI OpenBCI Pi Inference |
47 |
|
45 |
|
48 |
Edge inference of ECG R-peak detection and Respiration extraction using Raspberry Pi 4 using ECG (OpenBCI Ganglion). |
46 |
Edge inference of ECG R-peak detection and Respiration extraction using Raspberry Pi 4 using ECG (OpenBCI Ganglion). |
49 |
|
47 |
|
50 |
|
48 |
|
51 |
## Hardware Design |
49 |
## Hardware Design |
52 |
|
50 |
|
53 |
Wearable ECG electrodes --> OpenBCI Ganglion ---(Bluetooth)---> Raspberry Pi 4 |
51 |
Wearable ECG electrodes --> OpenBCI Ganglion ---(Bluetooth)---> Raspberry Pi 4 |
54 |
|
52 |
|
55 |
## Software Design |
53 |
## Software Design |
56 |
|
54 |
|
57 |
OpenBCI client ----(LSL)---> Python -> PyTorch inference --> Breathing Rate, Heart Rate |
55 |
OpenBCI client ----(LSL)---> Python -> PyTorch inference --> Breathing Rate, Heart Rate |
58 |
|
56 |
|
59 |
|
57 |
|
60 |
## Installation instruction |
58 |
## Installation instruction |
61 |
|
59 |
|
62 |
### Install PyTorch on Raspberry Pi 4: |
60 |
### Install PyTorch on Raspberry Pi 4: |
63 |
|
61 |
|
64 |
1. Install PyTorch dependicies |
62 |
1. Install PyTorch dependicies
|
65 |
`sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-yaml libatlas-base-dev` |
63 |
`sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-yaml libatlas-base-dev`
|
66 |
2. Increase swap file memory to 1600, Edit variable `CONF_SWAPSIZE` in `/etc/dphys-swapfile` |
64 |
2. Increase swap file memory to 1600, Edit variable `CONF_SWAPSIZE` in `/etc/dphys-swapfile`
|
67 |
3. Reset environmental variables like ONNX_ML [Instructions](https://gist.github.com/akaanirban/621e63237e63bb169126b537d7a1d979) |
65 |
3. Reset environmental variables like ONNX_ML [Instructions](https://gist.github.com/akaanirban/621e63237e63bb169126b537d7a1d979)
|
68 |
4. Download PyTorch package compiled for Armv7 ([torch-1.1.0-cp37-cp37m-linux_armv7l.whl](https://github.com/marcusvlc/pytorch-on-rpi/blob/master/torch-1.1.0-cp37-cp37m-linux_armv7l.whl)) |
66 |
4. Download PyTorch package compiled for Armv7 ([torch-1.1.0-cp37-cp37m-linux_armv7l.whl](https://github.com/marcusvlc/pytorch-on-rpi/blob/master/torch-1.1.0-cp37-cp37m-linux_armv7l.whl))
|
69 |
5. Install using the command `sudo pip3 install torch-1.1.0-cp37-cp37m-linux_armv7l.whl` in the same directory |
67 |
5. Install using the command `sudo pip3 install torch-1.1.0-cp37-cp37m-linux_armv7l.whl` in the same directory |
70 |
|
68 |
|
71 |
Refer [here](https://github.com/marcusvlc/pytorch-on-rpi) for troubleshooting |
69 |
Refer [here](https://github.com/marcusvlc/pytorch-on-rpi) for troubleshooting |
72 |
|
70 |
|
73 |
### Install OpenBCI Ganglion client on Raspberry Pi 4: |
71 |
### Install OpenBCI Ganglion client on Raspberry Pi 4: |
74 |
|
72 |
|
75 |
1. Clone OpenBCI_Python repo |
73 |
1. Clone OpenBCI_Python repo
|
76 |
`git clone htps://github.com/OpenBCI/OpenBCI_Python.git` |
74 |
`git clone htps://github.com/OpenBCI/OpenBCI_Python.git`
|
77 |
2. Install the following requisites python packages using `pip3 install` |
75 |
2. Install the following requisites python packages using `pip3 install`
|
78 |
pylsl, python-osc, six, socketIO-client, websocket-client, Yapsy, xmldict, bluepy |
76 |
pylsl, python-osc, six, socketIO-client, websocket-client, Yapsy, xmldict, bluepy
|
79 |
3. Open folder OpenBCI_Python and run |
77 |
3. Open folder OpenBCI_Python and run
|
80 |
`sudo python3 user.py --board ganglion -a streamer_lsl` to open a lab streaming layer stream of sensor data from the ganglion |
78 |
`sudo python3 user.py --board ganglion -a streamer_lsl` to open a lab streaming layer stream of sensor data from the ganglion
|
81 |
|
79 |
|
82 |
## Instructions to run to perform real time breathing rate/ heart rate inference using OpenBCI data |
80 |
## Instructions to run to perform real time breathing rate/ heart rate inference using OpenBCI data
|
83 |
1. Run the lsl streamer script to get data to the inference script |
81 |
1. Run the lsl streamer script to get data to the inference script
|
84 |
`sudo python3 user.py --board ganglion -a streamer_lsl` |
82 |
`sudo python3 user.py --board ganglion -a streamer_lsl`
|
85 |
3. Run the visualization and edge inference code on the pi using `python3 lsl_openbci.py` |
83 |
3. Run the visualization and edge inference code on the pi using `python3 lsl_openbci.py` |
86 |
|
84 |
|
87 |
|
85 |
|
88 |
## Sample Predictions |
86 |
## Sample Predictions
|
89 |
 |
87 |
 |
90 |
|
88 |
|
91 |
 |
|
|
92 |
Above is an example prediction for noisy real time ECG data obtained using the edge inference model. The beat predictions are represented as blue markers on the ECG. |
89 |
Above is an example prediction for noisy real time ECG data obtained using the edge inference model. The beat predictions are represented as blue markers on the ECG.
|