eugenelet / Meta-rPPG

Implementation of "Meta-rPPG: Remote Heart Rate Estimation Using a Transductive Meta-Learner"
MIT License
176 stars 38 forks source link

How to predict heart rate? #4

Open aptlin opened 4 years ago

aptlin commented 4 years ago

Could you please tell me whether to obtain the average heart rate it is enough to pass the output of the ordinal regression through the Hanh window, then Butterworth filter and Welch density decomposition, like the get_bpm function suggests?

https://github.com/eugenelet/Meta-rPPG/blob/bab00d97731d07966eaa3ca700be153fac0bd50a/data/data_utils.py#L127

If possible, I would be grateful if you could give an intuitive understanding of what the Butterworth bandpass does, since you use it both in pre-processing and post-processing.

aptlin commented 4 years ago

Seems like there is a bug or a typo, since filtered_sig is assigned but never used:

https://github.com/eugenelet/Meta-rPPG/blob/bab00d97731d07966eaa3ca700be153fac0bd50a/data/data_utils.py#L137

aptlin commented 4 years ago

Here are the metrics I get after running get_bpm on a sample of discretized PPG and heart rates from UBFC using the batch size of 8 and slicing a video segment of 6s into 60 frames:

Screen Shot 2020-08-03 at 13 37 49 Screen Shot 2020-08-03 at 13 35 26

The metrics seem way off. Could you please share how you have converted predicted ordinal values to heart rate?

aptlin commented 4 years ago

Here are the ideal metrics (obtained after running get_bpm on the ground truth segments for blocks of 60 frames) after switching to a higher sampling rate for the frames fed to the model (sampling on the (60/25)s timeframe). The result is still disappointing:

Screen Shot 2020-08-04 at 00 58 19

Could you please comment on the ideal results you get with your post-processing?

eugenelet commented 4 years ago

Hi there,

Thanks for taking interest on our work. May I ask what's the training data that you used to train the model? We have only provided a training dataset containing 2 users, which is not the entire dataset.

aptlin commented 4 years ago

The metrics above are for videos from the UBFC dataset that have frame rates greater than 25 fps. Batches of 60 frames were taken in each time period of 2.4 seconds, with the sliding window step of 1 second, and the corresponding ground truth ppg signals segmented into 40 regions which were then used to estimate heart rate using get_bpm from your repo. This estimated heart rate was then compared with the ground truth pulse from UBFC, which gave the results above (this approach of measuring mae/r2 was recently used for evaluation in the cvpr 2020 workshop on remote sensing). What kind of metrics do you get when you segment the ground truth ppg into ordinal values and use them for predicting pulse? Or did you avoid using ground truth pulse from ubfc in your comparison?

EvanChen022kan commented 4 years ago

Hi there,

the UBFC dataset we received from the author didn't contain the ground truth ppg. So we only take use of the ground truth ordinal values. The get_bpm function is for the model. The inaccuracy may be caused by a few reasons, first one is the low sampling rate (24 fps), second is that the sliding window for prediction is too small. You can use a bigger sliding window and a higher sampling rate when predicting in frequency domain.

aptlin commented 4 years ago

Thanks! So you used just the ordinal values for estimating heart rate on the UBFC dataset and comparing it with predicted values? In no way the ground truth for pulse was used for evaluation?

aptlin commented 4 years ago

Increasing the sampling rate to 29 and bumping the block size from 40 to 200, I get the following metrics after estimating heart rate from the ground truth ordinal values:

Screen Shot 2020-08-10 at 14 23 43

Pearson r is still a bit off in comparison with the results from your paper:

Screen Shot 2020-08-10 at 14 27 26
Z-Xiong commented 4 years ago

How do you train this network and what data sets are used? I use the deap dataset, which is difficult to converge.