From ade41839374e6c67a4abb489b32b72cdf83d6dfa Mon Sep 17 00:00:00 2001 From: Arritmic Date: Sat, 10 Jun 2023 02:45:58 +0300 Subject: [PATCH 1/2] Fixed bug in video frame rate in MAHNOB database file. Fixed minor typos. --- pyVHR/datasets/cohface.py | 2 +- pyVHR/datasets/ecg_fitness.py | 4 ++-- pyVHR/datasets/lgi_ppgi.py | 2 +- pyVHR/datasets/mahnob.py | 18 ++++++++-------- pyVHR/datasets/pure.py | 39 ++++++++++++++++++----------------- pyVHR/datasets/ubfc1.py | 2 +- pyVHR/datasets/ubfc2.py | 2 +- pyVHR/datasets/ubfc_phys.py | 2 +- pyVHR/datasets/v4v.py | 2 +- pyVHR/datasets/vicar_ppg.py | 2 +- pyVHR/datasets/vipl_hr_v1.py | 2 +- 11 files changed, 39 insertions(+), 38 deletions(-) diff --git a/pyVHR/datasets/cohface.py b/pyVHR/datasets/cohface.py index 5a1c8a6..a393988 100644 --- a/pyVHR/datasets/cohface.py +++ b/pyVHR/datasets/cohface.py @@ -31,7 +31,7 @@ class COHFACE(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 40 # number of subjects video_EXT = 'avi' # extension of the video files - frameRate = 20 # vieo frame rate + frameRate = 20 # video frame rate VIDEO_SUBSTRING = 'data' # substring contained in the filename SIG_EXT = 'hdf5' # extension of the BVP files SIG_SUBSTRING = 'data' # substring contained in the filename diff --git a/pyVHR/datasets/ecg_fitness.py b/pyVHR/datasets/ecg_fitness.py index 8061a03..ac83195 100644 --- a/pyVHR/datasets/ecg_fitness.py +++ b/pyVHR/datasets/ecg_fitness.py @@ -34,8 +34,8 @@ class ECG_FITNESS(Dataset): frameRate = 20 # video frame rate VIDEO_SUBSTRING = '' # substring contained in the filename SIG_EXT = 'csv' # extension of the ECG files - SIG_SUBSTRING = 'viatom' # substring contained in the filename - SIG_SampleRate = 120 # sample rate of the ECG files + SIG_SUBSTRING = 'viatom' # substring contained in the filename + SIG_SampleRate = 120 # sample rate of the ECG files def readSigfile(self, filename): """ Load ECG signal. diff --git a/pyVHR/datasets/lgi_ppgi.py b/pyVHR/datasets/lgi_ppgi.py index 9beedbc..f01d0c7 100644 --- a/pyVHR/datasets/lgi_ppgi.py +++ b/pyVHR/datasets/lgi_ppgi.py @@ -26,7 +26,7 @@ class LGI_PPGI(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 4 # number of subjects video_EXT = 'avi' # extension of the video files - frameRate = 25 # vieo frame rate + frameRate = 25 # video frame rate VIDEO_SUBSTRING = 'cv_camera' # substring contained in the filename SIG_EXT = 'xml' # extension of the BVP files SIG_SUBSTRING = 'cms50' # substring contained in the filename diff --git a/pyVHR/datasets/mahnob.py b/pyVHR/datasets/mahnob.py index 24a109c..d456864 100644 --- a/pyVHR/datasets/mahnob.py +++ b/pyVHR/datasets/mahnob.py @@ -12,6 +12,7 @@ """ + class MAHNOB(Dataset): """ Mahnob Dataset @@ -27,15 +28,15 @@ class MAHNOB(Dataset): .. |... """ name = 'MAHNOB' - signalGT = 'ECG' # GT signal type - numLevels = 2 # depth of the filesystem collecting video and BVP files - numSubjects = 40 # number of subjects - video_EXT = 'avi' # extension of the video files - frameRate = 20 # video frame rate + signalGT = 'ECG' # GT signal type + numLevels = 2 # depth of the filesystem collecting video and BVP files + numSubjects = 40 # number of subjects + video_EXT = 'avi' # extension of the video files + frameRate = 61 # video frame rate VIDEO_SUBSTRING = 'Section' # substring contained in the filename - SIG_EXT = 'bdf' # extension of the ECG files - SIG_SUBSTRING = 'emotion' # substring contained in the filename - SIG_SampleRate = 256 # sample rate of the ECG files + SIG_EXT = 'bdf' # extension of the ECG files + SIG_SUBSTRING = 'emotion' # substring contained in the filename + SIG_SampleRate = 256 # sample rate of the ECG files def readSigfile(self, filename): """ Load ECG signal. @@ -49,4 +50,3 @@ def readSigfile(self, filename): self.SIG_SampleRate = bdfRec.sampRate[33] data = np.array(rec['data'][0])[rec['eventTable']['idx'][2]:] return ECGsignal(data, self.SIG_SampleRate) - diff --git a/pyVHR/datasets/pure.py b/pyVHR/datasets/pure.py index a9149db..e9b0e71 100644 --- a/pyVHR/datasets/pure.py +++ b/pyVHR/datasets/pure.py @@ -7,6 +7,7 @@ import re import cv2 + class PURE(Dataset): """ PURE Dataset @@ -30,15 +31,15 @@ class PURE(Dataset): .. |... """ name = 'PURE' - signalGT = 'BVP' # GT signal type - numLevels = 1 # depth of the filesystem collecting video and BVP files - numSubjects = 10 # number of subjects - video_EXT = 'avi' # extension of the video files ### IMPORTANT NOTE: pure datasets consists of a sequence of png files, we converted them in a video avi files - frameRate = 30.0 # vieo frame rate + signalGT = 'BVP' # GT signal type + numLevels = 1 # depth of the filesystem collecting video and BVP files + numSubjects = 10 # number of subjects + video_EXT = 'avi' # extension of the video files ### IMPORTANT NOTE: pure datasets consists of a sequence of png files, we converted them in a video avi files + frameRate = 30.0 # video frame rate VIDEO_SUBSTRING = '-' # substring contained in the filename - SIG_EXT = 'json' # extension of the BVP files - SIG_SUBSTRING = '-' # substring contained in the filename - SIG_SampleRate = 60 # sample rate of the BVP files + SIG_EXT = 'json' # extension of the BVP files + SIG_SUBSTRING = '-' # substring contained in the filename + SIG_SampleRate = 60 # sample rate of the BVP files skinThresh = [40, 60] # thresholds for skin detection def readSigfile(self, filename): @@ -65,23 +66,23 @@ def loadFilenames(self): """ if self.name not in self.videodataDIR: - if self.videodataDIR[-1]=='/': + if self.videodataDIR[-1] == '/': self.videodataDIR += self.name else: self.videodataDIR = self.videodataDIR + '/' + self.name print(self.videodataDIR) - #check if video files exist or create them from images + # check if video files exist or create them from images for root, dirs, files in os.walk(self.videodataDIR): for d in dirs: dirname = os.path.join(root, d) - if not glob.glob(dirname +'/*.avi'): - #create videofile from images + if not glob.glob(dirname + '/*.avi'): + # create videofile from images frames = self.__loadFrames(dirname) fps = self.frameRate width = frames[0].shape[1] height = frames[0].shape[0] - #fourcc = cv2.VideoWriter_fourcc(*'MPNG') + # fourcc = cv2.VideoWriter_fourcc(*'MPNG') writer = cv2.VideoWriter(dirname + '/' + d + '.avi', 0, fps, (width, height)) for frame in frames: writer.write(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)) @@ -101,12 +102,12 @@ def loadFilenames(self): # -- number of videos self.numVideos = len(self.videoFilenames) - def __sort_nicely(self, l): + def __sort_nicely(self, l): """ Sort the given list in the way that humans expect. - """ - convert = lambda text: int(text) if text.isdigit() else text - alphanum_key = lambda key: [ convert(c) for c in re.split('([0-9]+)', key) ] - l.sort( key=alphanum_key ) + """ + convert = lambda text: int(text) if text.isdigit() else text + alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)] + l.sort(key=alphanum_key) return l def __loadFrames(self, directorypath): @@ -116,6 +117,6 @@ def __loadFrames(self, directorypath): for n in range(len(f_names)): filename = os.path.join(directorypath, f_names[n]) frames.append(cv2.imread(filename)[:, :, ::-1]) - + frames = np.array(frames) return frames diff --git a/pyVHR/datasets/ubfc1.py b/pyVHR/datasets/ubfc1.py index 6ae88f2..17a8bc6 100644 --- a/pyVHR/datasets/ubfc1.py +++ b/pyVHR/datasets/ubfc1.py @@ -22,7 +22,7 @@ class UBFC1(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 8 # number of subjects video_EXT = 'avi' # extension of the video files - frameRate = 30 # vieo frame rate + frameRate = 30 # video frame rate VIDEO_SUBSTRING = '' # substring contained in the filename SIG_EXT = 'xmp' # extension of the BVP files SIG_SUBSTRING = '' # substring contained in the filename diff --git a/pyVHR/datasets/ubfc2.py b/pyVHR/datasets/ubfc2.py index e31a629..9176e30 100644 --- a/pyVHR/datasets/ubfc2.py +++ b/pyVHR/datasets/ubfc2.py @@ -22,7 +22,7 @@ class UBFC2(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 26 # number of subjects video_EXT = 'avi' # extension of the video files - frameRate = 30 # vieo frame rate + frameRate = 30 # video frame rate VIDEO_SUBSTRING = 'vid' # substring contained in the filename SIG_EXT = 'txt' # extension of the BVP files SIG_SUBSTRING = '' # substring contained in the filename diff --git a/pyVHR/datasets/ubfc_phys.py b/pyVHR/datasets/ubfc_phys.py index 1c05309..617dd9e 100644 --- a/pyVHR/datasets/ubfc_phys.py +++ b/pyVHR/datasets/ubfc_phys.py @@ -22,7 +22,7 @@ class UBFC_PHYS(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 56 # number of subjects video_EXT = 'avi' # extension of the video files - frameRate = 35 # vieo frame rate + frameRate = 35 # video frame rate VIDEO_SUBSTRING = '' # substring contained in the filename SIG_EXT = 'csv' # extension of the BVP files SIG_SUBSTRING = 'bvp' # substring contained in the filename diff --git a/pyVHR/datasets/v4v.py b/pyVHR/datasets/v4v.py index 07fd441..a5ba992 100644 --- a/pyVHR/datasets/v4v.py +++ b/pyVHR/datasets/v4v.py @@ -22,7 +22,7 @@ class V4V(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 56 # number of subjects video_EXT = 'mkv' # extension of the video files - frameRate = 25 # vieo frame rate + frameRate = 25 # video frame rate VIDEO_SUBSTRING = '' # substring contained in the filename SIG_EXT = 'txt' # extension of the BVP files SIG_SUBSTRING = 'BP' # substring contained in the filename diff --git a/pyVHR/datasets/vicar_ppg.py b/pyVHR/datasets/vicar_ppg.py index a4cbcde..60b5b7e 100644 --- a/pyVHR/datasets/vicar_ppg.py +++ b/pyVHR/datasets/vicar_ppg.py @@ -22,7 +22,7 @@ class VICAR_PPG(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 40 # number of subjects video_EXT = 'mp4' # extension of the video files - frameRate = 60 # vieo frame rate + frameRate = 60 # video frame rate VIDEO_SUBSTRING = '' # substring contained in the filename SIG_EXT = 'csv' # extension of the BVP files SIG_SUBSTRING = '' # substring contained in the filename diff --git a/pyVHR/datasets/vipl_hr_v1.py b/pyVHR/datasets/vipl_hr_v1.py index a1625f7..bb724fc 100644 --- a/pyVHR/datasets/vipl_hr_v1.py +++ b/pyVHR/datasets/vipl_hr_v1.py @@ -22,7 +22,7 @@ class VIPL_HR_V1(Dataset): numLevels = 2 # depth of the filesystem collecting video and BVP files numSubjects = 107 # number of subjects video_EXT = 'avi' # extension of the video files - frameRate = 30 # vieo frame rate + frameRate = 30 # video frame rate VIDEO_SUBSTRING = 'video' # substring contained in the filename SIG_EXT = 'csv' # extension of the BVP files SIG_SUBSTRING = 'wave' # substring contained in the filename From 58a3c80a8c627e707fc93b26ed25a88a6b0b947a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Constantino=20=C3=81lvarez?= Date: Thu, 24 Aug 2023 12:24:33 +0300 Subject: [PATCH 2/2] Update README.md Updated OMIT method reference --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 9f4989f..14cf645 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ The framework contains the implementation of many common methods for remote-PPG |PCA | Lewandowska, M., Rumiński, J., Kocejko, T., & Nowak, J. (2011, September). Measuring pulse rate with a webcam—a non-contact method for evaluating cardiac activity. In 2011 federated conference on computer science and information systems (FedCSIS) (pp. 405-410). IEEE.| |POS | Wang, W., den Brinker, A. C., Stuijk, S., & de Haan, G. (2016). Algorithmic principles of remote PPG. IEEE Transactions on Biomedical Engineering, 64(7), 1479-1491.| |SSR | Wang, W., Stuijk, S., & De Haan, G. (2015). A novel algorithm for remote photoplethysmography: Spatial subspace rotation. IEEE transactions on biomedical engineering, 63(9), 1974-1984.| -|OMIT | Álvarez Casado, C., Bordallo López, M. (2022). Face2PPG: An unsupervised pipeline for blood volume pulse extraction from faces. arXiv (eprint 2202.04101).| +|OMIT | Álvarez Casado, C., & Bordallo López, M. (2023). Face2PPG: An unsupervised pipeline for blood volume pulse extraction from faces. IEEE Journal of Biomedical and Health Informatics, doi: 10.1109/JBHI.2023.3307942.| |MTTS-CAN | Liu, X., Fromm, J., Patel, S., & McDuff, D. (2020). Multi-task temporal shift attention networks for on-device contactless vitals measurement. Advances in Neural Information Processing Systems, 33, 19400-19411.| |HR-CNN | Spetlik, R., Franc, V., Cech, J. and Matas, J. (2018). Visual Heart Rate Estimation with Convolutional Neural Network. In Proceedings of British Machine Vision Conference| @@ -157,17 +157,17 @@ Currently supported datasets are: | Dataset name | Link | | ------------ | ---------------------------------------------------------------------- | -| COHFACE | https://www.idiap.ch/dataset/cohface | -| LGI-PPGI | https://github.com/partofthestars/LGI-PPGI-DB | -| MAHNOB-HCI | https://mahnob-db.eu/hci-tagging/ | -| PURE | https://www.tu-ilmenau.de/neurob/data-sets-code/pulse-rate-detection-dataset-pure| -| UBFC1 | https://sites.google.com/view/ybenezeth/ubfcrppg| -|UBFC2 | https://sites.google.com/view/ybenezeth/ubfcrppg| -|UBFC-Phys | https://sites.google.com/view/ybenezeth/ubfc-phys| -|ECG-Fitness | https://cmp.felk.cvut.cz/~spetlrad/ecg-fitness/* -|Vicar-PPG-2 | https://docs.google.com/forms/d/e/1FAIpQLScwnW_D5M4JVovPzpxA0Bf1ZCTaG5vh7sYu48I0MVSpgltvdw/viewform* -|V4V | https://vision4vitals.github.io/ | -|VIPL-HR |https://arxiv.org/abs/1810.04927 | +| COHFACE | https://www.idiap.ch/dataset/cohface | +| LGI-PPGI | https://github.com/partofthestars/LGI-PPGI-DB | +| MAHNOB-HCI | https://mahnob-db.eu/hci-tagging/ | +| PURE | https://www.tu-ilmenau.de/neurob/data-sets-code/pulse-rate-detection-dataset-pure| +| UBFC1 | https://sites.google.com/view/ybenezeth/ubfcrppg| +| UBFC2 | https://sites.google.com/view/ybenezeth/ubfcrppg| +| UBFC-Phys | https://sites.google.com/view/ybenezeth/ubfc-phys| +| ECG-Fitness | https://cmp.felk.cvut.cz/~spetlrad/ecg-fitness/* +| Vicar-PPG-2 | https://docs.google.com/forms/d/e/1FAIpQLScwnW_D5M4JVovPzpxA0Bf1ZCTaG5vh7sYu48I0MVSpgltvdw/viewform* +| V4V | https://vision4vitals.github.io/ | +| VIPL-HR |https://arxiv.org/abs/1810.04927 |