diff --git a/doc/guide_chrom.rst b/doc/guide_chrom.rst index 076c777de762c3657327fa92cb152991c9b504ee..e616258891fe7230cc24404bc42fc694ccf168a2 100644 --- a/doc/guide_chrom.rst +++ b/doc/guide_chrom.rst @@ -39,17 +39,55 @@ The mean skin color value is then computed, and projected onto the XY chrominanc colorspace. The signals in this colorspace are filtered using a bandpass filter before the final pulse signal is built. - To extract the pulse signal from video sequences, do the following:: - $ ./bin/chrom_pulse.py cohface -vv + $ ./bin/chrom_pulse.py config.py -vv To see the full options, including parameters and protocols, type:: $ ./bin/chrom_pulse.py --help -The output of this step normally goes into a directory (you can override on -the options for this application) named ``pulse``. +As you can see, the script takes a configuration file as argument. This +configuration file is required to at least specify the database, but can also +be used to provide various parameters. A full example of configuration is +given below. + +.. code-block:: python + + import os, sys + + # DATABASE + import bob.db.hci_tagging + import bob.db.hci_tagging.driver + if os.path.isdir(bob.db.hci_tagging.driver.DATABASE_LOCATION): + dbdir = bob.db.hci_tagging.driver.DATABASE_LOCATION + if dbdir == '': + print("You should provide a directory where the DB is located") + sys.exit() + database = bob.db.hci_tagging.Database() + protocol = 'cvpr14' + framerate = 61 + + basedir = 'chrom-hci-cvpr14/' + + # EXTRACT PULSE + pulsedir = basedir + 'pulse' + start = 306 + end = 2136 + motion = 0 + threshold = 0.1 + skininit = True + order = 128 + window = 0 + + # FREQUENCY ANALYSIS + hrdir = basedir + 'hr' + nsegments = 12 + nfft = 2048 + + # RESULTS + resultdir = basedir + 'results' + .. note:: diff --git a/doc/guide_cvpr14.rst b/doc/guide_cvpr14.rst index 4278ec7deafadd676a1f7990a3a906055cde202a..9a23cd23150b067ebb07bd400f2328b7f0991a84 100644 --- a/doc/guide_cvpr14.rst +++ b/doc/guide_cvpr14.rst @@ -22,37 +22,65 @@ The algorithm to retrieve the pulse signal can be divided into several steps: 3. Eliminating non-rigid motion. 4. Filtering +All the scripts rely on the usage of a configuration file, which specify the +database interface, the path where the raw data (i.e. video sequences) are stored +and various parameters. + +Below you can find a (minmal) example of a configuration file. + +.. code-block:: python + + import os, sys + import bob.db.hci_tagging + import bob.db.hci_tagging.driver + + if os.path.isdir(bob.db.hci_tagging.driver.DATABASE_LOCATION): + dbdir = bob.db.hci_tagging.driver.DATABASE_LOCATION + + if dbdir == '': + print("You should provide a directory where the DB is located") + sys.exit() + + database = bob.db.hci_tagging.Database() + protocol = 'cvpr14' + +As you can see, here you should **at least** have the `database` and +the `dbdir` parameters set. + Step 1: Extract signals from video sequences -------------------------------------------- This scripts first load previously detected facial keypoints to build the mask covering the bottom region of the face (note that the keypoints are not -provided, but could be obtained using bob.ip.flandmark for instance). Once the +provided, but could be obtained using `bob.ip.dlib +<https://gitlab.idiap.ch/bob/bob.ip.dlib>`_ for instance. Once the mask has been built, it is tracked across the whole sequence using the methodology described in [li-cvpr-2014]_. The face is detected using :py:func:`bob.ip.facedetect.detect_single_face`, and the -tracking makes usage of openCV (version 2). +tracking makes usage of OpenCV. To extract the mean green colors the face region and of -the background across the video sequences of the COHFACE -database, do the following:: +the background across the video sequences of the defined database +in the configuration file, do the following:: - $ ./bin/cvpr14_extract_signals.py cohface -vv + $ ./bin/cvpr14_extract_face_and_bg_signals.py config.py -vv To see the full options, including parameters and protocols, type:: - $ ./bin/cvpr14_extract_signals.py --help + $ ./bin/cvpr14_extract_face_and_bg_signals.py --help -The output of this step normally goes into directories (you can override on -the options for this application) named ``face`` and ``background``. +Note that you can either pass parameters through command-line, or +by specififing them in the configuration file. Be aware that +the command-line overrides the configuration file though. .. note:: The execution of this script is very slow - mainly due to the face detection. - You can speed it up using the gridtk_ (especially, if you're at Idiap). For example:: + You can speed it up using the gridtk_ toolbox (especially, if you're at Idiap). + For example:: - $ ./bin/jman sub -t 3490 -- ./bin/cvpr14_extract_signals.py cohface + $ ./bin/jman sub -t 3490 -- ./bin/cvpr14_extract_face_and_bg_signals. config.py The number of jobs (i.e. 3490) is given by typing:: @@ -68,10 +96,10 @@ Normalized Linear Mean Square and is then removed from the face signal. To get the rectified green signal of the face area, you should execute the following script:: - $ ./bin/cvpr14_illumination.py cohface -v + $ ./bin/cvpr14_illumination.py config.py -v -This script takes as input the result directories (normally named) ``face`` and -``background`` and outputs data to a directory named ``illumination``. +Again, parameters can be passed either through the configuration file or +the command-line Step 3: Non rigid Motion Elimination @@ -88,11 +116,6 @@ been eliminated, execute the following commands:: $ ./bin/cvpr14_motion.py cohface --save-threshold threshold.txt -vv $ ./bin/cvpr14_motion.py cohface --load-threshold threshold.txt -vv -This script takes as input the result directory (normally named) -``illumination`` and outputs data to a directory called -``motion``. The first call computes the threshold while the second -one actually discards segments and builds the corrected signals. - Step 4: Filtering ----------------- @@ -108,8 +131,68 @@ signal, you should execute the following command:: $ ./bin/cvpr14_filter.py cohface -vv -This script normally takes data from a directory called ``motion-eliminated`` -and outputs data to a directory called ``filtered``. +A Full Configuration File Example +--------------------------------- + +.. note:: + + This configuration file can (and probably should) be used with all the + scripts mentioned above + +.. code-block:: python + + import os, sys + + import bob.db.hci_tagging + import bob.db.hci_tagging.driver + + # DATABASE + if os.path.isdir(bob.db.hci_tagging.driver.DATABASE_LOCATION): + dbdir = bob.db.hci_tagging.driver.DATABASE_LOCATION + if dbdir == '': + print("You should provide a directory where the DB is located") + sys.exit() + database = bob.db.hci_tagging.Database() + protocol = 'cvpr14' + + basedir = 'li-hci-cvpr14/' + + # EXTRACT FACE AND BACKGROUND + facedir = basedir + 'face' + bgdir = basedir + 'bg' + npoints = 200 + indent = 10 + quality = 0.01 + distance = 10 + verbose = 2 + + # ILLUMINATION CORRECTION + illumdir = basedir + 'illumination' + start = 306 + end = 2136 + step = 0.05 + length = 3 + + # MOTION ELIMINATION + motiondir = basedir + 'motion' + seglength = 61 + cutoff = 0.05 + + # FILTERING + pulsedir = basedir + 'pulse' + Lambda = 300 + window = 21 + framerate = 61 + order = 128 + + # FREQUENCY ANALYSIS + hrdir = basedir + 'hr' + nsegments = 16 + nfft = 8192 + + # RESULTS + resultdir = basedir + 'results' + .. _gridtk: https://pypi.python.org/pypi/gridtk diff --git a/doc/guide_ssr.rst b/doc/guide_ssr.rst index c3f5269848a3e98ae278d583791653368e0eb7cb..b993a262844ba4c5373b76c6aa7e6b6e9c61bd4b 100644 --- a/doc/guide_ssr.rst +++ b/doc/guide_ssr.rst @@ -33,13 +33,53 @@ from each frame image. Hence, a skin color filter (:py:mod:`bob.ip.skincolorfilt is applied to retrieve a mask containing skin pixels. After having applied the skin color filter, the full algorithm is applied, -as described in Algorithm 1 in the paper. To get the pulse signal, do -the following:: +as described in Algorithm 1 in the paper. To get the pulse signals for +all video in a database, do the following:: - $ ./bin/ssr_pulse.py cohface + $ ./bin/ssr_pulse.py config.py -v -The result of this script will be the pulse signal. -The output of this step normally goes into a directory named ``pulse``. +To see the full options, including parameters and protocols, type:: + + $ ./bin/ssr_pulse.py --help + +As you can see, the script takes a configuration file as argument. This +configuration file is required to at least specify the database, but can also +be used to provide various parameters. A full example of configuration is +given below. + +.. code-block:: python + + import os, sys + import bob.db.hci_tagging + import bob.db.hci_tagging.driver + + if os.path.isdir(bob.db.hci_tagging.driver.DATABASE_LOCATION): + dbdir = bob.db.hci_tagging.driver.DATABASE_LOCATION + + if dbdir == '': + print("You should provide a directory where the DB is located") + sys.exit() + + database = bob.db.hci_tagging.Database() + protocol = 'cvpr14' + + basedir = 'ssr-hci-cvpr14/' + + # EXTRACT PULSE + pulsedir = basedir + 'pulse' + start = 306 + end = 2136 + threshold = 0.1 + skininit = True + stride = 30 + + # FREQUENCY ANALYSIS + hrdir = basedir + 'hr' + nsegments = 8 + nfft = 4096 + + # RESULTS + resultdir = basedir + 'results' .. note:: diff --git a/doc/index.rst b/doc/index.rst index 7138c4a395db09460db6303474589083800b8d64..c027caaa3d6abf6953ce6c888ca3c9faffdca63f 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -19,12 +19,15 @@ This module contains the implementation of different remote photoplesthymography * 2SR [wang-tbe-2015]_. Also, we provide scripts to infer the heart-rate from the pulse signals, and -to evaluate global performance on two different databases: Manhob HCI-Tagging -(http://mahnob-db.eu/hci-tagging/) and COHFACE (http://www.idiap.ch/dataset/cohface). +to evaluate global performance on a database. + +Note that this package was first meant to be used with the Manhob HCI-Tagging +(http://mahnob-db.eu/hci-tagging/) and COHFACE (http://www.idiap.ch/dataset/cohface) +databases, but could easily be extended to other datasets. .. warning:: - You should download the databases before trying to run anything below! + You should download the aforementioned databases before trying to run anything below! Documentation ------------- diff --git a/scripts-article/README.rst b/scripts-article/README.rst deleted file mode 100644 index 7c0ae97dc9982e5cc25e71c308a091f762159f8f..0000000000000000000000000000000000000000 --- a/scripts-article/README.rst +++ /dev/null @@ -1,35 +0,0 @@ -Scripts for generating article results --------------------------------------- - -In this folder, you can find the scripts that have been used to generate the -results in the article. They assume that the path to the database is either -'hci' or 'cohface' in the package root folder (this could be a symlink -though):: - - chrom-cohface-clean-natural.py --> Table 7 column 2 - chrom-cohface-clean.py --> Table 5, line 2 - chrom-cohface-complete-face.py --> Table 8, column 1, line 2 - chrom-cohface-complete-mask.py --> Table 8, column 3, line 2 - chrom-cohface-complete-skin.py --> Table 8, column 2, line 2 - chrom-hci-cvpr14.py --> Table 2, column 2 - chrom-hci-protocols.py --> Table 4, line 2 - chrom-xdb-cohface-hci.py --> Table 6, line 2, column 2 - chrom-xdb-hci-cohface.py --> Table 6, line 1, column 2 - li-cohface-clean-natural.py --> Table 7, column 1 - li-cohface-clean.py --> Table 5, line 1 - li-cohface-complete-mask.py --> Table 8, line 1, column 3 - li-cohface-complete-skin.py --> Table 8, line 1, column 2 - li-cohface-complete-wholeface.py --> Table 8, line 1, column 1 - li-hci-cvpr14.py --> Table 2, column 1 - li-hci-protocols.py --> Table 4, line 1 - li-xdb-cohface-hci.py --> Table 6, column 1, line 2 - li-xdb-hci-cohface.py --> Table 6, column 1, line 1 - ssr-cohface-clean-natural.py --> Table 7, column 3 - ssr-cohface-clean.py --> Table 5, line 3 - ssr-hci-cvpr14.py --> Table 2, column 3 - ssr-hci-protocols.py --> Table 4, line 3 - ssr-xdb-cohface-hci.py --> Table 6, column 3, line 2 - ssr-xdb-hci-cohface.py --> Table 6, column 3, line 1 - ssr-cohface-complete-face.py --> Table 8, line 3, column 1 - ssr-cohface-complete-skin.py --> Table 8, line 3, column 2 - ssr-cohface-complete-mask.py --> Table 8, line 3, column 3 diff --git a/scripts-article/chrom-cohface-clean-natural.py b/scripts-article/chrom-cohface-clean-natural.py deleted file mode 100644 index de63b1a9effca690e8f9aacffb07ffeff38c45ad..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-cohface-clean-natural.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/chrom-cohface-clean-natural/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.2 -order = 32 -window = 0 - -n_segments = 8 -nfft = 1024 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py cohface --protocol natural --subset test --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --window ' + str(window) + ' --skininit -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol natural --subset test --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol natural --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/chrom-cohface-clean.py b/scripts-article/chrom-cohface-clean.py deleted file mode 100644 index c3d5a97730ef3a090db4a3ff5e989c73f93137c6..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-cohface-clean.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join('experiments/paper/chrom-cohface-clean/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.2 -order = 32 -window = 0 - -n_segments = 8 -nfft = 1024 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py cohface --protocol clean --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --window ' + str(window) + ' --skininit -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol clean --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/chrom-cohface-complete-face.py b/scripts-article/chrom-cohface-complete-face.py deleted file mode 100644 index 0529e2c279aea33e1a36d0b5a967dfadf9120c46..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-cohface-complete-face.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join('experiments/paper/chrom-cohface-complete-face/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 -skin_threshold = 0.0 - -# parameters -order = 128 -window = 0 - -n_segments = 8 -nfft = 512 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py cohface --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --order ' + str(order) + ' --window ' + str(window) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/chrom-cohface-complete-mask.py b/scripts-article/chrom-cohface-complete-mask.py deleted file mode 100644 index 41df2512570e7d00e9bbbf06f18d77b7e296f4a3..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-cohface-complete-mask.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/chrom-cohface-complete-mask/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -npoints = 40 -indent = 15 - -order = 128 -window = 256 - -n_segments = 8 -nfft = 512 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n\n') -f.write('indent = ' + str(indent) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse_from_mask.py cohface --dbdir cohface --pulsedir ' + str(pulse_dir) + ' --framerate ' + str(framerate) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' --order ' + str(order) + ' --window ' + str(window) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/chrom-cohface-complete-skin.py b/scripts-article/chrom-cohface-complete-skin.py deleted file mode 100644 index 1d4bff4cf032c70e8f8e27bd8b2a34547bcf26d6..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-cohface-complete-skin.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join('experiments/paper/chrom-cohface-complete-skin/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.3 -order = 64 -window = 0 - -n_segments = 8 -nfft = 512 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py cohface --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --order ' + str(order) + ' --window ' + str(window) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/chrom-hci-cvpr14.py b/scripts-article/chrom-hci-cvpr14.py deleted file mode 100644 index a3a9aebae41b1de41855c21c9729e303212e9c23..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-hci-cvpr14.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/chrom-hci-cvpr14/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir = base_expe_dir + 'results' - -framerate = 61 - -# parameters -skin_threshold = 0.1 -order = 32 -window = 0 - -n_segments = 12 -nfft = 2048 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py hci --protocol cvpr14 --dbdir hci --bboxdir bounding-boxes --outdir ' + str(pulse_dir) + ' --start 306 --end 2136 --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --window ' + str(window) + ' --skininit -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --protocol cvpr14 --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --protocol cvpr14 --indir ' + hr_dir + ' --outdir ' + results_dir + ' -v') diff --git a/scripts-article/chrom-hci-protocols.py b/scripts-article/chrom-hci-protocols.py deleted file mode 100644 index fada77704af2bc240be29e93d3974bf0cea41b56..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-hci-protocols.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/chrom-hci-protocols/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 61 - -# parameters -skin_threshold = 0.3 -order = 32 -window = 32 - -n_segments = 8 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py hci --dbdir hci --bboxdir bounding-boxes --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --window ' + str(window) + ' --skininit -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py hci --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/chrom-xdb-cohface-hci.py b/scripts-article/chrom-xdb-cohface-hci.py deleted file mode 100644 index 8e5cdf3865d23330fbd4489e1edf63124329ba95..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-xdb-cohface-hci.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/chrom-xdb-cohface-hci/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 61 - -# parameters -skin_threshold = 0.2 -order = 32 -window = 0 - -n_segments = 8 -nfft = 1024 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py hci --subset test --dbdir hci --bboxdir bounding-boxes --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --window ' + str(window) + ' --skininit -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --subset test --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/chrom-xdb-hci-cohface.py b/scripts-article/chrom-xdb-hci-cohface.py deleted file mode 100644 index 2adc4e64ff24d9bd8463e251f2d68db77b78b3b1..0000000000000000000000000000000000000000 --- a/scripts-article/chrom-xdb-hci-cohface.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/chrom-xdb-hci-cohface/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.3 -order = 32 -window = 32 - -n_segments = 8 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('order = ' + str(order) + '\n\n') -f.write('window = ' + str(window) + '\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'chrom_pulse.py cohface --protocol clean --subset test --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --framerate ' + str(framerate) + ' --window ' + str(window) + ' --skininit -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol clean --subset test --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-cohface-clean-natural.py b/scripts-article/li-cohface-clean-natural.py deleted file mode 100644 index 093f27b9e40379cf957ec0080967b5552d6cdd31..0000000000000000000000000000000000000000 --- a/scripts-article/li-cohface-clean-natural.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -### WARNING ### -# be sure to first run li-cohface-clean.py to get the threshold file - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-cohface-clean-natural/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -npoints = 100 -indent = 10 - -adaptation = 0.01 -filter_length = 5 - -segment_length = 40 -cutoff = 0.02 -threshold_file = 'experiments/paper/li-cohface-clean/illumination/threshold.txt' - -Lambda = 300 -window = 3 -order = 32 - -n_segments = 4 -nfft = 4096 - - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n') -f.write('indent [%] = ' + str(indent) + '\n\n') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py cohface --protocol natural --subset test --dbdir cohface --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py cohface --protocol natural --subset test --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py cohface --protocol natural --subset test --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' +str(cutoff) + ' --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py cohface --protocol natural --subset test --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol natural --subset test --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol natural --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-cohface-clean.py b/scripts-article/li-cohface-clean.py deleted file mode 100644 index d91e56a48ec82e660342798ccb8a99c73344345e..0000000000000000000000000000000000000000 --- a/scripts-article/li-cohface-clean.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-cohface-clean/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -threshold_file = illumination_dir + '/threshold.txt' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -npoints = 100 -indent = 10 - -adaptation = 0.01 -filter_length = 5 - -segment_length = 40 -cutoff = 0.02 - -Lambda = 300 -window = 3 -order = 32 - -n_segments = 4 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n') -f.write('indent [%] = ' + str(indent) + '\n\n') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py cohface --protocol clean --dbdir cohface --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py cohface --protocol clean --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> determine the threshold -os.system(bin_folder + 'cvpr14_motion.py cohface --protocol clean --subset train --subset dev --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --save-threshold ' + threshold_file + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py cohface --protocol clean --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' +str(cutoff) + ' --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py cohface --protocol clean --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol clean --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-cohface-complete-face.py b/scripts-article/li-cohface-complete-face.py deleted file mode 100644 index 7f4c518fc3659b755a9a1dbacb739759937a338a..0000000000000000000000000000000000000000 --- a/scripts-article/li-cohface-complete-face.py +++ /dev/null @@ -1,92 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-cohface-complete-wholeface/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -threshold_file = illumination_dir + '/threshold.txt' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -#parameters -adaptation = 0.01 -filter_length = 5 - -segment_length = 40 -cutoff = 0.1 - -Lambda = 100 -window = 3 -order = 64 - -n_segments = 4 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py cohface --dbdir cohface --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --wholeface -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py cohface --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> determine the threshold -os.system(bin_folder + 'cvpr14_motion.py cohface --subset train --subset dev --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --save-threshold ' + threshold_file + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py cohface --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' +str(cutoff) + ' --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py cohface --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-cohface-complete-mask.py b/scripts-article/li-cohface-complete-mask.py deleted file mode 100644 index 28f70935ec86ba91b9152523f357264019778f36..0000000000000000000000000000000000000000 --- a/scripts-article/li-cohface-complete-mask.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-cohface-complete-mask/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -threshold_file = illumination_dir + '/threshold.txt' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -npoints = 200 -indent = 10 - -adaptation = 0.01 -filter_length = 5 - -segment_length = 40 -cutoff = 0.02 - -Lambda = 300 -window = 3 -order = 32 - -n_segments = 4 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n') -f.write('indent [%] = ' + str(indent) + '\n\n') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py cohface --subset train --subset dev --dbdir cohface --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py cohface --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> determine the threshold -os.system(bin_folder + 'cvpr14_motion.py cohface --subset train --subset dev --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --save-threshold ' + threshold_file + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py cohface --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' +str(cutoff) + ' --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py cohface --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-cohface-complete-skin.py b/scripts-article/li-cohface-complete-skin.py deleted file mode 100644 index d271a03889085015af550cedc60cc01ba466d949..0000000000000000000000000000000000000000 --- a/scripts-article/li-cohface-complete-skin.py +++ /dev/null @@ -1,94 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-cohface-complete-skin/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -threshold_file = illumination_dir + '/threshold.txt' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -#parameters -skin_threshold = 0.8 - -adaptation = 0.01 -filter_length = 3 - -segment_length = 40 -cutoff = 0.1 - -Lambda = 100 -window = 3 -order = 128 - -n_segments = 8 -nfft = 512 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_video2skin.py cohface --dbdir cohface --outdir ' + str(facedir) + ' --threshold ' + str(skin_threshold) + ' -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py cohface --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> determine the threshold -os.system(bin_folder + 'cvpr14_motion.py cohface --subset train --subset dev --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --save-threshold ' + threshold_file + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py cohface --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' +str(cutoff) + ' --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py cohface --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-hci-cvpr14.py b/scripts-article/li-hci-cvpr14.py deleted file mode 100644 index 03b2950d0b84698eed372cd197d2e16460f3d67e..0000000000000000000000000000000000000000 --- a/scripts-article/li-hci-cvpr14.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-hci-cvpr14/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -threshold_file = illumination_dir + '/threshold.txt' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir = base_expe_dir + 'results' - -# fixed parameter -framerate = 61 - -# parameters -npoints = 200 -indent = 10 - -adaptation = 0.05 -filter_length = 3 - -segment_length = 61 -cutoff = 0.05 - -Lambda = 300 -window = 21 -order = 128 - -n_segments = 16 -nfft = 8192 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n') -f.write('indent [%] = ' + str(indent) + '\n\n') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py hci --protocol cvpr14 --dbdir hci, --bboxdir bounding-boxes --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py hci --protocol cvpr14 --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' --start 306 --end 2136 -v') - -# motion elimination -> determine the threshold -os.system(bin_folder + 'cvpr14_motion.py hci --protocol cvpr14 --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --save-threshold ' + threshold_file + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py hci --protocol cvpr14 --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength 61 --cutoff 0.05 --load-threshold ' + threshold_file + ' -v') - -# filter -os.system(bin_folder + 'cvpr14_filter.py hci --protocol cvpr14 --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --protocol cvpr14 --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --protocol cvpr14 --indir ' + hr_dir + ' --outdir ' + results_dir + ' -v') diff --git a/scripts-article/li-hci-protocols.py b/scripts-article/li-hci-protocols.py deleted file mode 100644 index 053f0c93cc3dfb785693bb0b1e9d4fae648052c0..0000000000000000000000000000000000000000 --- a/scripts-article/li-hci-protocols.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-hci-protocols/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -threshold_file = illumination_dir + '/threshold.txt' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 61 - -# parameters -npoints = 400 -indent = 10 - -adaptation = 0.05 -filter_length = 3 - -segment_length = 30 -cutoff = 0.1 - -Lambda = 500 -window = 23 -order = 96 - -n_segments = 12 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n') -f.write('indent [%] = ' + str(indent) + '\n\n') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py hci --dbdir hci, --bboxdir bounding-boxes --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py hci --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> determine the threshold -os.system(bin_folder + 'cvpr14_motion.py hci --subset train --subset dev --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --save-threshold ' + threshold_file + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py hci --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength 61 --cutoff 0.05 --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py hci --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py hci --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-xdb-cohface-hci.py b/scripts-article/li-xdb-cohface-hci.py deleted file mode 100644 index 6d0f58cd6ce52f109c31a75801047e9918d8b789..0000000000000000000000000000000000000000 --- a/scripts-article/li-xdb-cohface-hci.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -### WARNING ### -# be sure to run li-cohface-clean.py first to get the threshold file - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-xdb-cohface-hci/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 61 - -# parameters -npoints = 100 -indent = 10 - -adaptation = 0.01 -filter_length = 5 - -segment_length = 120 # 2 times the framerate, as for COHFACE training set -cutoff = 0.02 -threshold_file = 'experiments/paper/li-cohface-clean/illumination/threshold.txt' - -Lambda = 300 -window = 9 -order = 96 - -n_segments = 4 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n') -f.write('indent [%] = ' + str(indent) + '\n\n') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py hci --dbdir hci --subset test --bboxdir bounding-boxes --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --npoints ' + str(npoints) ' --indent ' + str(indent)) - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py hci --subset test --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py hci --subset test --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py hci --subset test --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --subset test --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/li-xdb-hci-cohface.py b/scripts-article/li-xdb-hci-cohface.py deleted file mode 100644 index 71a34e1b81a1f824c840972455883c233e661aac..0000000000000000000000000000000000000000 --- a/scripts-article/li-xdb-hci-cohface.py +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -### WARNING ### -# be sure to first run li-hci-protocols.py to get the required threshold file - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/li-xdb-hci-cohface/') -facedir = base_expe_dir + 'face' -bgdir = base_expe_dir + 'bg' -illumination_dir = base_expe_dir + 'illumination' -motion_dir = base_expe_dir + 'motion' -filtered_dir = base_expe_dir + 'filtered' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -npoints = 400 -indent = 10 - -adaptation = 0.05 -filter_length = 3 - -segment_length = 10 # half of the frame rate -cutoff = 0.1 -threshold_file = 'experiments/paper/li-hci-protocols/illumination/threshold.txt' - -Lambda = 500 -window = 23 -order = 96 - -n_segments = 12 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n') -f.write('indent [%] = ' + str(indent) + '\n\n') -f.write('adaptation step = ' + str(adaptation) + '\n') -f.write('filter length = ' + str(filter_length) + '\n\n') -f.write('segment length [frames] = ' + str(segment_length) + '\n') -f.write('cutoff [% / 100] = ' + str(cutoff) + '\n\n') -f.write('lambda = ' + str(Lambda) + '\n') -f.write('window = ' + str(window) + '\n') -f.write('order = ' + str(order) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# signals extraction -os.system(bin_folder + 'cvpr14_extract_signals.py cohface --protocol clean --subset test --dbdir cohface --facedir ' + str(facedir) + ' --bgdir ' + str(bgdir) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' -v') - -# illumination correction -os.system(bin_folder + 'cvpr14_illumination.py cohface --protocol clean --subset test --facedir ' + facedir + ' --bgdir ' + bgdir + ' --outdir ' + illumination_dir + ' --step ' + str(adaptation) + ' --length ' + str(filter_length) + ' -v') - -# motion elimination -> remove segments -os.system(bin_folder + 'cvpr14_motion.py cohface --protocol clean --subset test --indir ' + illumination_dir + ' --outdir ' + motion_dir + ' --seglength ' + str(segment_length) + ' --cutoff ' + str(cutoff) + ' --load-threshold ' + threshold_file + ' -v') - -# filtering -os.system(bin_folder + 'cvpr14_filter.py cohface --protocol clean --subset test --indir ' + motion_dir + ' --outdir ' + filtered_dir + ' --lambda ' + str(Lambda) + ' --window ' + str(window) + ' --order ' + str(order) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol clean --subset test --indir ' + filtered_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-cohface-clean-natural.py b/scripts-article/ssr-cohface-clean-natural.py deleted file mode 100644 index f3c1f4eea4947f299a36d4d2d909fa307d517754..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-cohface-clean-natural.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/ssr-cohface-clean-natural/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.8 -stride = 80 - -n_segments = 8 -nfft = 2048 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse.py cohface --protocol natural --subset test --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol natural --subset test --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' + str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol natural --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-cohface-clean.py b/scripts-article/ssr-cohface-clean.py deleted file mode 100644 index 3a4802fde74e9f7f469fac9c56bf45fddf279983..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-cohface-clean.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/ssr-cohface-clean/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.8 -stride = 80 - -n_segments = 8 -nfft = 2048 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse.py cohface --protocol clean --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol clean --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' + str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-cohface-complete-face.py b/scripts-article/ssr-cohface-complete-face.py deleted file mode 100644 index 560c58a6f4e7e1c50c1885536d03929d6327e0bb..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-cohface-complete-face.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join('experiments/paper/ssr-cohface-complete-face/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 -skin_threshold = 0.0 - -# parameters -stride = 10 - -n_segments = 16 -nfft = 512 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse.py cohface --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-cohface-complete-mask.py b/scripts-article/ssr-cohface-complete-mask.py deleted file mode 100644 index a283a5b30fe2a4ca0e9c9c59e7ac56f4790663da..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-cohface-complete-mask.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/ssr-cohface-complete-mask/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -npoints = 100 -indent = 10 - -stride = 10 - -n_segments = 8 -nfft = 1024 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('npoints = ' + str(npoints) + '\n\n') -f.write('indent = ' + str(indent) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse_from_mask.py cohface --dbdir cohface --pulsedir ' + str(pulse_dir) + ' --npoints ' + str(npoints) + ' --indent ' + str(indent) + ' --stride ' + str(stride) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-cohface-complete-skin.py b/scripts-article/ssr-cohface-complete-skin.py deleted file mode 100644 index a3f8244884c1f47cf78d86a7b9568509cb99ae3d..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-cohface-complete-skin.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join('experiments/paper/ssr-cohface-complete-skin/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.6 -stride = 10 - -n_segments = 8 -nfft = 512 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('threshold = ' + str(skin_threshold) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse.py cohface --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py cohface --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-hci-cvpr14.py b/scripts-article/ssr-hci-cvpr14.py deleted file mode 100644 index 694d4a57d246531568c8e24a11b43dd451bfb971..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-hci-cvpr14.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/ssr-hci-cvpr14/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir = base_expe_dir + 'results' - -framerate = 61 - -# parameters -skin_threshold = 0.1 -stride = 30 - -n_segments = 8 -nfft = 4096 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse.py hci --protocol cvpr14 --dbdir hci --bboxdir bounding-boxes --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' --start 306 --end 2136 -v --skininit') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --protocol cvpr14 --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --protocol cvpr14 --indir ' + hr_dir + ' --outdir ' + results_dir + ' -v') diff --git a/scripts-article/ssr-hci-protocols.py b/scripts-article/ssr-hci-protocols.py deleted file mode 100644 index 0eff543e7735f95f4fb2de3883fc79a1cb7c20a3..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-hci-protocols.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/ssr-hci-protocols/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 61 - -# parameters -skin_threshold = 0.1 -stride = 30 - -n_segments = 8 -nfft = 8192 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse.py hci --dbdir hci --bboxdir bounding-boxes --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' -v --skininit') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --subset train --subset dev --indir ' + hr_dir + ' --outdir ' + results_dir_train + ' -v') -os.system(bin_folder + 'rppg_compute_performance.py hci --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-xdb-cohface-hci.py b/scripts-article/ssr-xdb-cohface-hci.py deleted file mode 100644 index e2fbb0ff27f83c822c630b0bef487d1f768426b8..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-xdb-cohface-hci.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/ssr-xdb-cohface-hci/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 61 - -# parameters -skin_threshold = 0.8 -stride = 80 - -n_segments = 8 -nfft = 2048 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -# pulse extraction -os.system(bin_folder + 'ssr_pulse.py hci --subset test --dbdir hci --bboxdir bounding-boxes --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' -v') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py hci --subset test --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' + str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py hci --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v') diff --git a/scripts-article/ssr-xdb-hci-cohface.py b/scripts-article/ssr-xdb-hci-cohface.py deleted file mode 100644 index 4eb84414a067fc17e96a9fda27d7652bf02b8a24..0000000000000000000000000000000000000000 --- a/scripts-article/ssr-xdb-hci-cohface.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -# Copyright (c) 2017 Idiap Research Institute, http://www.idiap.ch/ -# Written by Guillaume Heusch <guillaume.heusch@idiap.ch>, -# -# This file is part of bob.rpgg.base. -# -# bob.rppg.base is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. -# -# bob.rppg.base is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with bob.rppg.base. If not, see <http://www.gnu.org/licenses/>. - -import os, sys - -# directories and file -current_folder = os.path.dirname(os.path.abspath(__file__)) -root_folder = os.path.dirname(current_folder) -bin_folder = os.path.join(root_folder, 'bin/') - -base_expe_dir = os.path.join(root_folder, 'experiments/paper/ssr-xdb-hci-cohface/') -pulse_dir = base_expe_dir + 'pulse' -hr_dir = base_expe_dir + 'hr' -results_dir_train = base_expe_dir + 'results-train' -results_dir_test = base_expe_dir + 'results-test' - -framerate = 20 - -# parameters -skin_threshold = 0.1 -stride = 30 - -n_segments = 8 -nfft = 8192 - -# write a file with the parameters - useful to keep track sometimes .. -param_file = base_expe_dir + '/parameters.txt' -if not os.path.isdir(base_expe_dir): - os.makedirs(base_expe_dir) - -f = open(param_file, 'w') -f.write('skin threshold = ' + str(skin_threshold) + '\n\n') -f.write('stride = ' + str(stride) + '\n\n') -f.write('Welch segments = ' + str(n_segments) + '\n') -f.write('npoints FFT = ' + str(nfft) + '\n') -f.close() - -os.system(bin_folder + 'ssr_pulse.py cohface --protocol clean --subset test --dbdir cohface --outdir ' + str(pulse_dir) + ' --threshold ' + str(skin_threshold) + ' --stride ' + str(stride) + ' -v --skininit') - -# computing heart-rate -os.system(bin_folder + 'rppg_get_heart_rate.py cohface --protocol clean --subset test --indir ' + pulse_dir + ' --outdir ' + hr_dir + ' --framerate ' + str(framerate) + ' --nsegments ' +str(n_segments) + ' --nfft ' + str(nfft) + ' -v') - -# computing performance -os.system(bin_folder + 'rppg_compute_performance.py cohface --protocol clean --subset test --indir ' + hr_dir + ' --outdir ' + results_dir_test + ' -v')