You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The output of the above code shows: a tensor with shape of (2, 900) after hr_fft_batch() function shape changed to (2,), and then I applied the output tensor to the scipy.stats.pearsonr functionto find the Pearson coefficient, but error:
File "test.py", line 132, in my_main
correlation_coefficient, _ = pearsonr(hr_pred[i].flatten(), hr_gt[i].flatten())
The File "/ share1 / home/zhouwenqing/anaconda3 / envs/RPPG/lib/python3.6 / site - packages/scipy/stats/stats. Py", line 3838, in pearsonr
raise ValueError('x and y must have length at least 2.')
ValueError: x and y must have length at least 2.
That is, thepearsonr()function requires that the input arrays x and y have at least two elements, because the Pearson correlation coefficient is a statistic that measures the strength and direction of the linear relationship between two variables. What should I do about it?
The text was updated successfully, but these errors were encountered:
To calculate Pearson correlation, you should first get the predicted HR values and GT HR values from all your video clips. Then input them into scipy.stats.pearsonr to get the Pearson correlation.
To calculate Pearson correlation, you should first get the predicted HR values and GT HR values from all your video clips. Then input them into scipy.stats.pearsonr to get the Pearson correlation.
But isn't the function hr_fft_batch() used to calculate heart rate? The aforementioned error information indicates that the scipy.stats.pearsonr function requires that the input arrays x and y have at least two elements, however, the function hr_fft_batch() changes the tensor with shape (2, 900) to (2, 1)
Some errors occurred when I used the following code to calculate
MAE, RMSE,
andPearson coefficients
:The output of the above code shows: a tensor with shape of
(2, 900)
afterhr_fft_batch()
function shape changed to(2,)
, and then I applied the output tensor to thescipy.stats.pearsonr
functionto find the Pearson coefficient, but error:That is, the
pearsonr()
function requires that the input arrays x and y have at least two elements, because the Pearson correlation coefficient is a statistic that measures the strength and direction of the linear relationship between two variables. What should I do about it?The text was updated successfully, but these errors were encountered: