TomStog / Infrared-BP

The dataset used for the "Non-Contact Blood Pressure Estimation using infrared motion magnified facial video" publication. The code developed is to fit the data to the reference Blood Pressure values.
9 stars 0 forks source link

blood pressure based on facial video #1

Closed chengzhangsuper closed 10 months ago

chengzhangsuper commented 11 months ago

I would like to ask if there is any code to detect blood pressure based on facial video. Thank you very much.

TomStog commented 11 months ago

Thank you very much for your comment. Unfortunately, there wasn't any code developed for measuring blood pressure on facial video alone. Although, i've seen plenty papers in the literature attempting to detect blood pressure on facial video based on some differential measurement (e.g. forehead-chin). I'd be very happy to help with the code or give some advice based on your dataset.

TomStog commented 11 months ago

This is the link of our paper, with our methodology explained and tested [https://utopia.duth.gr/nmitiano/pdf/CNNA_2023_1.pdf]

chengzhangsuper commented 11 months ago

Thank you very much

chengzhangsuper commented 11 months ago

Hello, I'm a novice, so I don’t understand in some places. I want to ask if your code uses the data set in your link?

TomStog commented 11 months ago

Actually, the code used for calculating the Pulse Transit Time from dataset's videos, isn't uploaded (haven't polished it yet). It is written in MATLAB. I will make some changes and will upload it later today. I will leave a comment here notifying you.

chengzhangsuper commented 11 months ago

Thank you for your help. I still have a few questions. Which part of the paper is this code responsible for? What problem does it solve? What is the innovation point of the paper? Thank you very much. I am new to this field and don’t understand much. , thank you for your answer.

TomStog commented 11 months ago

The code (that is now officially uploaded) is for the procedure described in the final paragraph of the "Proposed Methodology" section. The code is responsible for processing the signals of the two origin sources, the forehead and the upper palm and produces the "blood_pressure_mean_std.csv" file. Then, based on this file, the regression algorithms make an estimate of the systolic and diastolic blood pressure. The innovation of this paper is that we are the first to make an accurate blood pressure estimate using exclusively infrared (single-colour) cameras. In a few weeks, we expect the augmented version of this paper to be published by MDPI. In the said version, we dive deeper into detail.

chengzhangsuper commented 10 months ago

Thank you very much for your code, I would like to ask if it is possible to run all the code using only python, because I have not used MATLAB. thanks for your answer

TomStog commented 10 months ago

Unfortunately there's not a Python version of this code available. Luckily, there are multiple ways and tools available online to convert MATLAB code into Python code.

chengzhangsuper commented 10 months ago

Thank you for your answer. I am currently trying to use MATLAB to reproduce the code, but I have some problems because I just started learning. The error keepsmalldif (line 2) temp_array1 = array1;

chengzhangsuper commented 10 months ago

matchAndExcludePeaks (line 3) len1 = length(peaks1);

chengzhangsuper commented 10 months ago

Prompt that the number of parameters entered is insufficient.

TomStog commented 10 months ago

"keepsmalldif.m" and "matchAndExcludePeaks.m" are supportive functions. If you try to run them, you will end up with these errors, because they lacking the input. The main program is "PTT_Estimation.m", this is the MATLAB file you should be running to get your results. And you need "PTT_Estimation.m", "keepsmalldif.m" and "matchAndExcludePeaks.m" in the same folder, so the functions can be called. And also be careful with the directory path of the dataset, make sure it is in the correct folder. Ofcourse you can alter the dataset directory path as you like.

chengzhangsuper commented 10 months ago

Thank you for taking the time to answer my questions, test1 = median(abs(matchedPeaks1-matchedPeaks2))1000/vidObj2.FrameRate; test1 = median(abs(matchedPeaks3-matchedPeaks4))1000/vidObj2.FrameRate; M_temp = [M_temp;test1]; N_temp = [N_temp;test2];

PTT_Estimation (line 103) N_temp = [N_temp;test2]; There are two test1s here. Is it wrong? The second one should be test2? After I changed it to test2, the code kept running and generated more than 100 figures. The program never stopped. Should I change it to test2 or should I wait for the code to run?

TomStog commented 10 months ago

You are correct, there should be "test2" instead. I fixed the typo and commented out the figure plotting part. You should give it some time, a few minutes (I have checked, it's not endless loop).

chengzhangsuper commented 10 months ago

Hello, I just looked at your updated code, but the final generated file is blood_pressure_test_1.xlsx, not blood_pressure_mean_std

chengzhangsuper commented 10 months ago

the proposed machine learning regression approaches were implemented using Python v3.8.10, employing the scikit-learn package. For the face/hand detection and segmentation algorithm, Python v3.10.8 was employed. I would like to know what function the uploaded python code is responsible for, whether it is a machine learning regression method or a face/hand detection and segmentation algorithm, or all of them.

chengzhangsuper commented 10 months ago

Thank you for answering my doubts. I have been studying for a long time but I still don’t quite understand.

TomStog commented 10 months ago

Indeed, xlsx and csv files had different names, fixed this typo as well and committed the changes. Be aware that the conversion from xlsx to csv needs to be done manually. The "regressors_bp_2.py" and "blood_pressure_gam.py" are integral to the functioning of regression only. The face/hand detection and segmentation code (which is not uploaded) returned the coordinates of volunteer's forehead and palm. Using these coordinates, I managed to crop these regions of interest from the original video recordings. After careful consideration, to avoid any compatibility issues, the proposed machine learning regression approaches can be compiled using Python v3.10.8 as well.

chengzhangsuper commented 10 months ago

Can you upload the face/hand detection and segmentation code? Thank you. Will the results be affected if there is no such code? My purpose is to use your code to identify blood pressure. Can the code run normally if I change it to another infrared video data set?

TomStog commented 10 months ago

I appreciate your willingness to share the code. In order to proceed, could you please provide access to the dataset that you used for training and testing purposes? This will enable me to replicate and validate the results effectively. If there are any concerns regarding data privacy or sensitivity, we can discuss potential alternatives to ensure a secure and mutually beneficial collaboration.

chengzhangsuper commented 10 months ago

Sorry, I don't have a data set. What I mean is that if I change to an infrared video data set, can this code still run normally?Can you upload the face/hand detection and segmentation code? Thank you. Will the results be affected if there is no such code? I don't have the face/hand detection and segmentation code ,I want to try to reproduce your code。

TomStog commented 10 months ago

The code was build to run for an infrared dataset only. Yes, the results will be affected. The code is now uploaded.