It is a small example to show how to transfer ECG from PPG with a pretrained model. The detail is in inference.py.
Download the pretrained weights from UQVIT dataset.
Put it in ./weights
.
https://drive.google.com/file/d/10aYWNkgaGCz1zU6--kN3yaW6L_9BzkhQ/view?usp=sharing
(Sorry for the inconvience. The model weights are lost.)
python3 inference.py --weights weights/model_best.pth --input example/PPG.npy
You need to preprocess your data before feeding in the model.
- The input size should be [1, 200] (1 representing the feature dimension and 200 means 2 seconds with sampling rate 100Hz)
- The input data range should be [-1, 1] (Be careful for the outliers)
- In pytorch, the input data needs batch dimension, so the final shape should be [1, 1, 200] ([batch, feature, length])
The model will perform better in the middle range of input data due to the convolution property. So we recommend to make a running window with step=100 to inferece.
For example, if we have a PPG data which has the length of 500, we should inference the data index by [0, 200], [100, 300], [200, 400], [300, 500]. And we extract the middle range of them by [50, 150] + [150, 250] + [250, 350] + [350, 450] to reconstruct the whole ECG.
Simple result from ./example/PPG.npy