Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About preprocessing. py(BVP) #11

Open
ldxbxl opened this issue Mar 25, 2024 · 4 comments
Open

About preprocessing. py(BVP) #11

ldxbxl opened this issue Mar 25, 2024 · 4 comments

Comments

@ldxbxl
Copy link

ldxbxl commented Mar 25, 2024

I would like to know when using OpenFace to generate .csv file during data preprocessing, as one of the inputs of preprocessing. py, which part of preprocessing. py represents the generated .h5 contains the content of bvp signal?
I read my own generated.h5 file containing only {'imgs': }

@ldxbxl
Copy link
Author

ldxbxl commented Mar 25, 2024

I would like to know when using OpenFace to generate .csv file during data preprocessing, as one of the inputs of preprocessing. py, which part of preprocessing. py represents the generated .h5 contains the content of bvp signal? I read my own generated.h5 file containing only {'imgs': }

I'm sorry that I didn't see the answer to the previous relevant questions. Now I know that the bvp related content needs to be added manually in the.h5 file during the test. May I ask how to add the bvp information specifically?

@zhaodongsun
Copy link
Owner

zhaodongsun commented Mar 25, 2024

Hi, the bvp has the same sampling rate as the video frames. e.g., video is 30 fps, so the bvp should be 30Hz. Therefore, the temporal lengths of both bvp and imgs should be the same. If imgs has the shape (T, H, W, 3), the bvp should have the shape (T,). You can easily add bvp to .h5 file as shown below.

with h5py.open('xxxxx', 'r+') as f:
    f['bvp'] = bvp

@ldxbxl
Copy link
Author

ldxbxl commented Mar 26, 2024

Hi, the bvp has the same sampling rate as the video frames. e.g., video is 30 fps, so the bvp should be 30Hz. Therefore, the temporal lengths of both bvp and imgs should be the same. If imgs has the shape (T, H, W, 3), the bvp should have the shape (T,). You can easily add bvp to .h5 file as shown below.

with h5py.open('xxxxx', 'r+') as f:
    f['bvp'] = bvp

Thanks for your answer.

I applied for the ubfc-rppg dataset, in which dataset2 folder each video contains the corresponding groundturth.txt, how should I deal with them and merge them into.h5? I used the following code to merge.
import numpy as np
import h5py

bvp_data = np.loadtxt('dataset/ubfc-rppg/UBFC_DATASET/DATASET_2/subject49/ground_truth.txt')

with h5py.File('dataset/ubfc-rppg/UBFC_DATASET/DATASET_2/h5withbvp/49.h5', 'r+') as f:

f.create_dataset('bvp', data=bvp_data)

I use the following code to output the contents of the keys to test.py's.npy file. The output is Loaded data keys: dict_keys(['rppg_list', 'bvp_list']).

def main():
npy_file = "/contrast-phys/results/11/4/38.npy"
try:
data = np.load(npy_file, allow_pickle=True).item()
print("Loaded data keys:", data.keys())

@ldxbxl
Copy link
Author

ldxbxl commented Mar 26, 2024

Hi, the bvp has the same sampling rate as the video frames. e.g., video is 30 fps, so the bvp should be 30Hz. Therefore, the temporal lengths of both bvp and imgs should be the same. If imgs has the shape (T, H, W, 3), the bvp should have the shape (T,). You can easily add bvp to .h5 file as shown below.

with h5py.open('xxxxx', 'r+') as f:
    f['bvp'] = bvp

Thanks for your answer.

I applied for the ubfc-rppg dataset, in which dataset2 folder each video contains the corresponding groundturth.txt, how should I deal with them and merge them into.h5? I used the following code to merge. import numpy as np import h5py

bvp_data = np.loadtxt('dataset/ubfc-rppg/UBFC_DATASET/DATASET_2/subject49/ground_truth.txt')

with h5py.File('dataset/ubfc-rppg/UBFC_DATASET/DATASET_2/h5withbvp/49.h5', 'r+') as f:

f.create_dataset('bvp', data=bvp_data)

I use the following code to output the contents of the keys to test.py's.npy file. The output is Loaded data keys: dict_keys(['rppg_list', 'bvp_list']).

def main(): npy_file = "/contrast-phys/results/11/4/38.npy" try: data = np.load(npy_file, allow_pickle=True).item() print("Loaded data keys:", data.keys())

Upon further inspection I found that the.npy generated by test.pys is an empty array

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants