(a) Illustration of contrastive learning. It maximizes the similarity between
- Python 3.9
- Cuda 12.1
- Pytorch 2.31
- Required libraries are listed in requirements.txt.
pip install -r requirements.txtDownload the SleepEDF20, and MASS3 and put them the data dir.
Convert the data to .npz format.
python Preprocessing.pyOur model consist of pretrain and fintuing part.
First, model's feature extractor learn the domain-invarint feature via multi-scale minimal sufficient learning.
python Pretrain.pySecond, To demonstrate the performance of the feature extractor, we train a transformer-based classifier while keeping the parameters of the feature extractor fixed. The transformer-based classifier follows the model proposed in prior work SleePyCo for sleep scoring.
python FineTuning.pyThe code is inspired by prior awesome works:
SleePyCo: Automatic sleep scoring with feature pyramid and contrastive learning (Expert Systems with Applications 2024)
MVEB: Self-Supervised Learning With Multi-View Entropy Bottleneck (Transactions on Pattern Analysis and Machine Intelligence 2024)
