The code supporting the findings of this study is available for non-commercial academic purposes, subject to a formal code usage agreement. For access, please contact the corresponding author (hongnju@njust.edu.cn).
- Operating System: Windows 10/11, Ubuntu 20.04, MacOS
- Python Version: 3.8
- Software Dependencies:
keras==2.9.0matplotlib==3.7.5numpy==1.24.4scipy==1.15.1tensorflow_gpu==2.9.0importlib-metadata==7.1.0
Make sure all required dependencies are installed using the following steps.
Clone the repository to your local machine using:
git clone https://github.com/zhuangzx1127/ResSleepNet.git
cd ResSleepNetIt is highly recommended to create a virtual environment for this project. You can do this by running:
python -m venv venv
source venv/bin/activate # For Linux/macOS
venv\Scripts\activate # For WindowsThen, install the required dependencies:
pip install -r requirements.txtThis will install the necessary libraries including Keras, Matplotlib, Numpy, SciPy, and TensorFlow.
After installing all dependencies, you can run the demo with the following command:
python test.pyAfter running the demo, you should see the following output:
-
Predicted AHI Value:
predicted AHI: X.XX
-
Sleep Stage Plot: A plot will be generated showing the predicted sleep stages and their probability distribution. The top part of the plot represents the predicted sleep stages (REM, Deep, Light, Wake), while the bottom part shows the probability distribution for each stage across epochs.
The demo script typically runs in 5 seconds on a "normal" desktop computer.
- Clone the repository as described above.
- Install the dependencies using the command:
pip install -r requirements.txt. - Run the script
test.pyto start the demonstration or to interact with the main functions of the code.
If you want to reproduce all quantitative results in the manuscript, follow these additional steps:
- Make sure that you have a compatible GPU setup for TensorFlow.
- Modify any parameters as needed in
test.pyfor your data or to fit specific experimental conditions.