It is shown that early mobilization and physical therapy is a safe and effective intervention method that can have a significant impact on patient health. A sensor band will be used to measure mobility data from patients. Machine Learning will then be applied to accelerometer and gyroscope sensor data to accurately determine the actions the sensor band is measuring. The nurses can then use this data to determine how mobile a patient is during their stay compared to their pre-hospitalization mobility levels.
- 95% machine learning model classification accuracy 🧠
- Standing 🕴
- Sitting ⑁
- Lying down 🛌
- Walking 🚶♀️
- Sensor band battery lasts 12+ hours 🔋
- Sensor band is easy to clean, wear and remove ✨
- Compare baseline mobility to recorded mobility 💪
- Other things? (eg: live data streaming, ...)
Machine learning experimentation is being done on Google CoLab. The editing link can be found here. (Requires McMaster Unviersity account)
The data is being recorded from the band at 25Hz intervals, containing accelerometer and gyroscope measurements. The data is then processed into 2.5 second long windows with a 2 second overlap between each window. Each window then processes statistical information such as average, minimum, and maximum values for x, y, and z rotational and acceleration values. This preprocessing creates 24 features for our data set
|{accelerometer, gyroscope}| * |{x, y, z}| * |{max, min, avg, var}| = 24
This 24 feature data set is then dimensionally reduced with Principle Component Analysis using Minka's MLE to guess the dimension. The results set is then passed to a Multilayer Perceptron classifier model where the hyperparameters are tuned to maximize test set accuracy.
To get started with the machine learning side of this project, visit the Google Colab link above and check out the machine_learning directory.
Patients will wear the clinical grade wristband, MetaMotionR (MMR), produced by MbientLab with several sensors including a pressure sensor, temperature sensor, and an Inertial Measurement Unit (IMU). The unit is housed in an IP40 case and is strapped on the user with a rubber wrist band.
- 8MB of NOR flash memory that can be used to log data
- Stream data live using a Bluetooth
- 100 mAH rechargeable battery that can be recharged using a micro-USB connection
To get started with the sensor band side of this project, check out the frontend directory.
The server stores two data sets, accelerometer and gyroscope. It determines when and how the subject is moving. The data sets are collected through the bands that patients will be wearing. The Android application will upload this data after it is collected. The app can request data to display it to the user.
To get started with the server and database side of this project, checkout the backend directory.
The following are instructions on how to set up the entire backend, including the machine learning portion using docker on a server.
- Install Docker CE and Docker Compose
- Install Nginx and start it.
- Edit /etc/nginx/sites-available/default (your configuration file might have a different name or a different location) and set the following for port 80:
location / {
proxy_pass http://localhost:5000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
- Test the changes by running
sudo nginx -t
and reload nginxsudo nginx -s reload
. - Clone this repository anywhere on the machine.
- To start the docker services run
sudo docker-compose up -d --build web
. - Once completed the status of the container can be checked by using
sudo docker logs <name of image>
.- To get the name of the image (there are 3 running, the dotnet server, the ML server, and the postgres instance) run
sudo docker ps
and look under the "IMAGE" column - The names at the time of writing this are: dotnet server: 'mobilityai_web', ML server: 'mobilityai_ml', and Postgres: 'postgres'.
- To get the name of the image (there are 3 running, the dotnet server, the ML server, and the postgres instance) run
- To create a bash shell into one of the instances, use
sudo docker ps
to get the "CONTAINER ID" for the desired instance, then run `sudo docker exec -it bash'