From 792ed65132ce983c7360b576ed41eb802ddab36d Mon Sep 17 00:00:00 2001 From: Xiaohui Zhang Date: Tue, 4 Jun 2024 23:58:37 -0500 Subject: [PATCH] Update README.md --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index c0c2561..fe51df3 100644 --- a/README.md +++ b/README.md @@ -46,7 +46,9 @@ Part of the WFCI data used in this paper is available on PhysioNet. To note, If ├── mouse_split.json ├── train_tfrecords.sh ├── utils.py - └── visualize_lstm_attention_weights.py + ├── visualize_lstm_attention_weights.py + └── example_notebook.ipynb + ├── Results   ├── fragmented_sleep.m    ├── overlay_heatmap_gradcam.m @@ -57,19 +59,20 @@ Part of the WFCI data used in this paper is available on PhysioNet. To note, If    └── visualize_attention_weights.m ``` #### In the `Scripts` folder, these are mainly the scripts for training and testing of the bidirectional LSTM model. -- `main.py`: the main python script to launch the network training, validation, testing, computing the Grad-CAM and extracting the temporal attention weights by defining the parameter `mode` in the config file `train_tfrecords.sh`. -- `create_tfrecords*.py`: data preprocessing code to create tfrecords from continuous WFCI recordings. When the requested epoch lenghth is large than 10 second, the code takes additional frames in the adjacent epochs to compose the final epoch, eg., take adjacent 5-second in the epoch N-1 and epoch N+1 to compose a 20-second length for epoch N. -- `dataloader_sleep.py`: the dataloader to create tf.dataset object for network input, need to be modified accordingly. -- `model_attention_bilstm.py`: code for building the hybrid attention-based bi-lstm model. -- `AttentionLayer.py`: TensorFlow wrapper functions for building various type of attention module, including the LSTM attention, the spatial [SimAM](http://proceedings.mlr.press/v139/yang21o.html) and [CBAM](https://doi.org/10.48550/arXiv.1807.06521) module. -- `gradcam.py`: code to compute the [Grad-CAM](https://doi.org/10.48550/arXiv.1610.02391) heatmaps. -- `visualize_lstm_attention_weights.py`: code to visualize learned attention scores of each time steps in a given 10-s input. -- `mouse_split.json`: config file to define the train/validation/test split. +- `main.py`: the main python script to launch the network training, validation, testing, computing the Grad-CAM and extracting the temporal attention weights by defining the parameter `mode` in the config file `train_tfrecords.sh` +- `create_tfrecords*.py`: data preprocessing code to create tfrecords from continuous WFCI recordings. When the requested epoch lenghth is large than 10 second, the code takes additional frames in the adjacent epochs to compose the final epoch, eg., take adjacent 5-second in the epoch N-1 and epoch N+1 to compose a 20-second length for epoch N +- `dataloader_sleep.py`: the dataloader to create tf.dataset object for network input, need to be modified accordingly +- `model_attention_bilstm.py`: code for building the hybrid attention-based bi-lstm model +- `AttentionLayer.py`: TensorFlow wrapper functions for building various type of attention module, including the LSTM attention, the spatial [SimAM](http://proceedings.mlr.press/v139/yang21o.html) and [CBAM](https://doi.org/10.48550/arXiv.1807.06521) module +- `gradcam.py`: code to compute the [Grad-CAM](https://doi.org/10.48550/arXiv.1610.02391) heatmaps +- `visualize_lstm_attention_weights.py`: code to visualize learned attention scores of each time steps in a given 10-s input +- `mouse_split.json`: config file to define the train/validation/test split +- `example_notebook.ipynb`: a jupyter notebook example for training model interatively #### In the `Results` folder, these are mainly the MATLAB codes to analyze the sleep scoring results. -- `plot_hypnogram.m`: cpde to ploy color-coded hypnogram. -- `plot_gradcam.m`: overlay Grad-CAM heatmap on a selected frame with the help of function `overlay_heatmap_gradcam.m`. -- `fragmented_sleep.m`: code to calculate the number of sleep transitions and the average length in each of the sleep states. -- `visualize_attention_weights.m`: visualize the color-coded attention weights. +- `plot_hypnogram.m`: cpde to ploy color-coded hypnogram +- `plot_gradcam.m`: overlay Grad-CAM heatmap on a selected frame with the help of function `overlay_heatmap_gradcam.m` +- `fragmented_sleep.m`: code to calculate the number of sleep transitions and the average length in each of the sleep states +- `visualize_attention_weights.m`: visualize the color-coded attention weights ## Running the Code - The main setup for running the code is running: ``` @@ -77,7 +80,34 @@ Part of the WFCI data used in this paper is available on PhysioNet. To note, If ``` by setting the `mode` as `train` for training the network, `gradcam` for generating the Grad-CAM heatmap for given inputs and `attention_weights` for extacting the temporal attention scores. ## Citations -If you use our codes to investigating the functional brain network in WFCI, and/or the example data in your research, the authors of this software would like you to cite our paper and/or conference proceedings in your related publications. +If you use our codes to classify brain states of WFCI data, and/or the example data in your research, the authors of this software would like you to cite our paper and/or conference proceedings in your related publications. ``` -TBD +@inproceedings{zhang2023attention, + title={Attention-based CNN-BiLSTM for sleep state classification of spatiotemporal wide-field calcium imaging data}, + author={Zhang, Xiaohui and Landsness, Eric C and Culver, Joseph P and Lee, Jin-Moo and Anastasio, Mark A}, + booktitle={Neural Imaging and Sensing 2023}, + volume={12365}, + pages={39--42}, + year={2023}, + organization={SPIE} +} + +@article{zhang2022automated, + title={Automated sleep state classification of wide-field calcium imaging data via multiplex visibility graphs and deep learning}, + author={Zhang, Xiaohui and Landsness, Eric C and Chen, Wei and Miao, Hanyang and Tang, Michelle and Brier, Lindsey M and Culver, Joseph P and Lee, Jin-Moo and Anastasio, Mark A}, + journal={Journal of neuroscience methods}, + volume={366}, + pages={109421}, + year={2022}, + publisher={Elsevier} +} + +@article{chen2022validation, + title={Validation of Deep Learning-based Sleep State Classification}, + author={Chen, Wei and Zhang, Xiaohui and Miao, Hanyang and Tang, Michelle J and Anastasio, Mark and Culver, Joseph and Lee, Jin-Moo and Landsness, Eric C}, + journal={microPublication biology}, + volume={2022}, + year={2022}, + publisher={California Institute of Technology} +} ```