Git Product home page Git Product logo

oxwearables / ssl-wearables Goto Github PK

View Code? Open in Web Editor NEW
81.0 8.0 20.0 104.04 MB

Self-supervised learning for wearables using the UK-Biobank (>700,000 person-days)

Home Page: https://oxwearables.github.io/ssl-wearables/

License: Other

Python 2.60% Jupyter Notebook 97.40%
accelerometer deep-learning human-activity-recognition self-supervised-learning wearable foundation-models pytorch

ssl-wearables's People

Contributors

aidanacquah avatar angerhang avatar apcreagh avatar chanshing avatar gmertes avatar valerianrey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ssl-wearables's Issues

Cannot load the pre-trained model

I used the provided torch hub way to load the harnet5/10/30 model, but I wanted to be able to make inference in Rowland labels, so I download and attempted to load the Rowland pre-trained model. However, it seemed like the Rowland Pre-trained model has a different model architecture than the Torch hub models. Can you please clarify?

Another adjacent question is, does 'Rowland Pre-trained' model mean a model that

  1. Trained from scratch using the Rowland dataset
  2. Trained on the UK-biobank contrastively and fine-tuned on the Rowland dataset?

Mismatch between provided labels in Capture-24 and published figures?

Hello authors,

I saw that using your processed capture 24_30hz_full Y.npy, the unique labels are
{'moderate-vigorous', 'sleep', 'light', 'sedentary'}
However, I was confused when I see the corresponding UMAP feature map in the paper.
image
Can you please explain the difference?

As a side question, with all due respect why was the subset of labels chosen out of the annotation directory, dubbed Walmsley2020? They seem to be easy to be distinguished by the the magnitude of accelerator along and does not carry any periodic information or fine upper body activity.

Clinical validation using MJFF Levodopa Response Study

  • Process the MJFF with labels in 10 seconds epoch.

Experiments
Both the below experiments can be run using https://github.com/OxWearables/ssl-wearables/blob/main/downstream_task_evaluation.py

Example scripts to run for different modes. Ask Hang for model weights for different pre-trained models.

python downstream_task_evaluation.py data=pamap_10s evaluation=hand_crafted
python downstream_task_evaluation.py gpu=1 data=pamap_10s evaluation=flip_net_random_mlp model=resnet
python downstream_task_evaluation.py gpu=0 data=pamap_10s evaluation=flip_net_ft_freeze model=resnet
python downstream_task_evaluation.py gpu=2 data=pamap_10s evaluation=flip_net_ft model=resnet
python downstream_task_evaluation.py gpu=3 data=pamap_10s evaluation=flip_net_100k_ft model=resnet
  • Add MJFF results to Table 2: RF+fine-tuning results
  • Add MJFF results to Table 3: fine-tuning results
  • Add PCA MJFF results to Figure 2: feature visu. Ask Shing for code pointer

The model weights for Table 2 can be downloaded from Github readme links. For Table 3, self-supervised ones, you can get from Github readme links too. Ask Hang for the supervised weights.

Writing

  • Add MJFF descriptions to Table 4: dataset descriptions

Generate 5sec version pre-training model

Because of the lack the homogenous baselines, to validate the effectiveness of the SSL models, we shall also assess the model performance using a different window length

  • Reprocess all the baseline datasets using 5 sec window
  • Pretrain the SSL model in 5 sec window
  • Evaluate the SSL with on all the baselines and generates the benchmark table

What is the context about the example of pre-trained model usage?

Hi! First of all, thanks for this high quality and open research!

I ran the usage example shown in the README.md:

import torch
import numpy as np

repo = 'OxWearables/ssl-wearables'
harnet5 = torch.hub.load(repo, 'harnet5', class_num=5, pretrained=True)
x = np.random.rand(1, 3, 150)
x = torch.FloatTensor(x)
harnet5(x)

harnet10 = torch.hub.load(repo, 'harnet10', class_num=5, pretrained=True)
x = np.random.rand(1, 3, 300)
x = torch.FloatTensor(x)
harnet10(x)

harnet30 = torch.hub.load(repo, 'harnet30', class_num=5, pretrained=True)
x = np.random.rand(1, 3, 900)
x = torch.FloatTensor(x)
harnet30(x)

I have trouble understanding exactly what the harnet models are. I understand that they are instances of sslearning.models.accNet.Resnet, and my understanding is the following:

  • The feature_extractor part was pre-trained using multi-task SSL on UK-Biobank dataset, as explained in your paper
  • The classifier part is not trained at all, and we have to train it on any labelled classification dataset (what makes me understand this is that we can select any number class_num).

Is my understanding correct?
Also, would it be possible to write this information next to the usage example?

Thanks a lot in advance :)

Build Failure: Dockerfile Dependency Installation Errors from req.txt

Overview:
I am encountering an issue when building a Docker dev container to run this repo through vs code, specifically during the installation of dependencies from a req.txt file. The build process fails with several errors related to various dependencies.

Environment:

Docker version: 4.26.0
Operating System: Windows 11

Steps To Reproduce:

  1. Build Docker Dev Container using the follow dockerfile and compose files:
# Use Ubuntu as the base image
FROM ubuntu:18.04

# Install Python 3.7
RUN apt-get update && \
    apt-get install -y software-properties-common && \
    add-apt-repository ppa:deadsnakes/ppa && \
    apt-get update && \
    apt-get install -y python3.7 python3-pip python3.7-dev

# Create a working directory
WORKDIR /app

# Copy the requirements file into the container
COPY req.txt /app/

# Install Python dependencies
RUN pip install -r req.txt

# Install JupyterLab
RUN pip install jupyterlab

# Expose the port JupyterLab will use
EXPOSE 8888

# Set up the entry point to launch JupyterLab
ENTRYPOINT ["jupyter", "lab", "--ip=0.0.0.0", "--allow-root", "--NotebookApp.token=''", "--NotebookApp.password=''"]
version: '3.8'

services:
  dev:
    build:
      context: .
      dockerfile: dockerfile.dev
    ports:
      - "8888:8888"
    volumes:
      - .:/app
    command: jupyter lab --ip=0.0.0.0 --allow-root --NotebookApp.token='' --NotebookApp.password=''

Expected Behavior:
The Docker container should build without errors, and all dependencies listed in the req.txt file should be installed correctly.

Actual Behavior:
During the build process, the installation of dependencies fails. Dependencies that might be at issue include:
numpy
Werkzeug
pandas
scipy
torch
sci-kitlearn

I would appreciate any guidance on resolving these build errors or suggestions on changes to the Dockerfile or req.txt that might mitigate these issues. Also I would like to raise the question as to why such antiquated packages are being used, many of them are deprecated and no longer supported (e.g. python 3.7 and torch 1.4). The reliance on outdated packages could cause major issues in the future.

Only 131 weights loaded

Hello,

I am running this code to load the model:

import torch repo = 'OxWearables/ssl-wearables' harnet = torch.hub.load(repo, "harnet30", class_num=5, pretrained=True)

However, it returns while saying: 131 Weights loaded
This seems odd to me as the network has a few million.

Happens on: python3.8 with pytorch 2.1.2 and pytorch 1.11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.