AI4HealthUOL / SSSD-ECG

Repository for the paper: 'Diffusion-based Conditional ECG Generation with Structured State Space Models'
MIT License
36 stars 4 forks source link

How to visualize the generated sample #6

Closed XLIU430 closed 1 year ago

XLIU430 commented 1 year ago

Hello, I run the inference.py script and successfully generated a sample with the "generate_four_leads()" function. The shape of sample is (400,12,1000) and the shape of label is (400,44). Are the shapes correct? I am little struggling to visualize the output. Could you please give me some advices on how to use matplotlib to visualize the generated sample? Thank you!

juanlopezcode commented 1 year ago

Seems that your shapes are correct. You might need to adjust your custom function for the plot as you desire. Or you can use a library like this: https://pypi.org/project/ecg-plot/.

dtt355 commented 1 year ago

Hello, when I was running inference.py, error KeyError: 'use_model''masking' and so on occurred. How should I solve it?Thank you!

juanlopezcode commented 1 year ago

unsure, this si not a complete error output to be able to trace it

dtt355 commented 1 year ago

When I run "ecg_data_preprocessing.ipynb", I get an error that the label "label_diag_filtered_numeric" cannot be found. I found in the run "df_ptb_xl, lbl_itos_ptb_xl, mean_ptb_xl, std_ptb_xl = prepare_data_ptb_xl(data_folder_ptb_xl, min_cnt=0, target_fs=target_fs, channels=12, channel_stoi=channel_stoi_default, target_folder=target_folder_ptb_xl)" min_cnt=0 is passed in, so the "map_and_filter_labels" function in the file that executes "SSD-ECG-main/src/ptb_xl/clinical_ts/ecg_utils.py" is not called. So what should I set min_cnt to?

juanlopezcode commented 1 year ago

I didn't run the code now, but I did before, I have the feeling that you don't need to change these parameters, anyway for a easy use, I uploaded the labels in the mega directory

juanlopezcode commented 11 months ago

https://mega.nz/folder/UfUDFYjS#YYUJ3CCUGb6ZNmJdCZLseg