-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/zhengbi-yong/PPG
- Loading branch information
Showing
17 changed files
with
1,429 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
_target_: src.data.PPGFieldStudyMvCFTDatamodule.PPGDataModule | ||
data_dir: "./data/PPG_FieldStudy/PPG_FieldStudy" | ||
window_size: 256 | ||
stride: 128 | ||
batch_size: 64 | ||
num_workers: 4 # Set to 0 for debugging | ||
train_split: 0.7 | ||
val_split: 0.15 | ||
test_split: 0.15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# @package _global_ | ||
|
||
# to execute this experiment run: | ||
# python train.py experiment=example | ||
|
||
defaults: | ||
- override /data: PPG_FieldStudy_MvCFT | ||
- override /model: PPGMvCFT | ||
- override /callbacks: default | ||
- override /trainer: default | ||
|
||
# all parameters below will be merged with parameters from default configurations set above | ||
# this allows you to overwrite only specified parameters | ||
|
||
tags: ["PPG_FieldStudy", "PPGMvCFT"] | ||
|
||
seed: 12345 | ||
|
||
trainer: | ||
min_epochs: 10 | ||
max_epochs: 50 | ||
gradient_clip_val: 0.5 | ||
accelerator: "gpu" | ||
devices: 1 | ||
callbacks: [progress_bar] | ||
enable_checkpointing: True | ||
|
||
model: | ||
input_dim: 14 | ||
d_model: 128 | ||
lr: 1e-3 | ||
|
||
data: | ||
batch_size: 64 | ||
|
||
logger: | ||
wandb: | ||
tags: ${tags} | ||
group: "PPG_FieldStudy" | ||
aim: | ||
experiment: "PPG_FieldStudy" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
_target_: src.models.PPGMvCFTModule.PPGMvCFTModule | ||
|
||
input_dim: 14 | ||
d_model: 128 | ||
lr: 1e-3 |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
```csv | ||
date,segment,time_sec,time_min,frequency_hz,amplitude,phase,label | ||
2024-11-17,1,7.0,0.11666666666666667,37993.1,12.93741,-4.32236,0 | ||
2024-11-17,1,7.0,0.11666666666666667,41437.9,12.87911,-4.04065,0 | ||
2024-11-17,1,8.0,0.13333333333333333,44882.8,12.78722,-3.65708,0 | ||
2024-11-17,1,8.0,0.13333333333333333,48327.6,12.73593,-3.31598,0 | ||
2024-11-17,1,9.0,0.15,51772.4,12.69731,-2.83716,0 | ||
``` | ||
我的数据如上,请你基于Pytorch写一个血糖三分类的模型,label 0 代表低,1代表中,2代表高。 | ||
请你将数据按照1分钟的长度来进行划分,写出dataset和dataloader,并帮我写出完整的训练验证以及测试流程代码。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
我现在需要做一个血糖高中低三分类的项目,我的数据集如下 | ||
```zsh | ||
(base) sisyphus@sisyphus-dual4090 ~/Projects/PPG/data master tree GlucoseBIT | ||
GlucoseBIT | ||
├── 2024-11-13 | ||
│ ├── 1-24.txt | ||
│ ├── 2-24.txt | ||
│ └── 3-24.txt | ||
├── 2024-11-17 | ||
│ ├── 1-10.txt | ||
│ ├── 2-12.txt | ||
│ ├── 3-10.txt | ||
│ ├── 4-12.txt | ||
│ ├── 5-10.txt | ||
│ └── 6-12.txt | ||
└── 2024-11-18 | ||
├── 1-12.txt | ||
├── 2-12.txt | ||
├── 3-12.txt | ||
├── 4-10.txt | ||
├── 5-12.txt | ||
├── 6-10.txt | ||
└── 7-10.txt | ||
|
||
3 directories, 16 files | ||
``` | ||
每个txt文件的文件名意义如下: | ||
-号前面的数字代表第几段,-号后面的数字代表持续时间, | ||
例如2024-11-17的3-10.txt文件中记录的是当次实验的第22-32分钟时间段的数据。 | ||
每个txt内部的数据如下 | ||
```txt | ||
00:00:02 | ||
6989.7 hz | ||
15.40351 -7.47591 | ||
00:00:03 | ||
10434.5 hz | ||
15.56827 -9.31106 | ||
00:00:03 | ||
13879.3 hz | ||
15.69426 -14.58940 | ||
00:00:04 | ||
17324.1 hz | ||
15.27117 -19.40495 | ||
00:00:04 | ||
20769.0 hz | ||
15.15964 -20.27624 | ||
00:00:05 | ||
24213.8 hz | ||
14.57288 -18.74838 | ||
00:00:05 | ||
27658.6 hz | ||
14.27791 -15.12476 | ||
00:00:06 | ||
31103.4 hz | ||
14.10476 -9.03115 | ||
``` | ||
以下面的数据单元为例 | ||
00:00:06 | ||
31103.4 hz | ||
14.10476 -9.03115 | ||
最上面的是时间,第二行是频率,第三行左边的是幅值,右边的是相位。 | ||
|
||
请你完成几件事情: | ||
1.将每一天的数据集合并成一份,并且存储为csv格式,并且根据时间打上标签0-10分钟和65分钟之后是低,10-25和45-65分钟是中,25-45是高。 | ||
2.使用Pytorch框架来帮我写一个血糖三分类的模型 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import kagglehub | ||
import os | ||
import shutil | ||
|
||
# 下载数据集到默认的缓存路径 | ||
path = kagglehub.dataset_download("dishantvishwakarma/ppg-dataset-shared") | ||
print("下载完成,数据集路径为:", path) | ||
|
||
# 设定目标文件夹路径,将数据集移至该脚本父目录的父目录下的 data 文件夹 | ||
target_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))), "data") | ||
|
||
# 如果目标文件夹不存在,创建该文件夹 | ||
os.makedirs(target_path, exist_ok=True) | ||
|
||
# 将数据集文件逐个复制到目标文件夹 | ||
for item in os.listdir(path): | ||
source_item = os.path.join(path, item) | ||
target_item = os.path.join(target_path, item) | ||
|
||
# 如果目标文件已存在,跳过复制 | ||
if os.path.exists(target_item): | ||
print(f"文件已存在,跳过复制: {target_item}") | ||
else: | ||
if os.path.isdir(source_item): | ||
shutil.copytree(source_item, target_item) | ||
else: | ||
shutil.copy2(source_item, target_item) | ||
|
||
print("数据集已移动到目标路径:", target_path) |
Oops, something went wrong.