pyVHR.analysis package¶
Submodules¶
pyVHR.analysis.pipeline module¶
- class pyVHR.analysis.pipeline.Pipeline¶
Bases:
object
This class runs the pyVHR pipeline on a single video or dataset
- parse_cfg(configFilename)¶
parses the given configuration file for loading the test’s parameters.
- Parameters
configFilename – configuation file (.cfg) name of path .
- run_on_dataset(configFilename, verb=True)¶
Runs the tests as specified in the loaded config file.
- Parameters
configFilename –
The path to the configuration file
verb –
False - not verbose
True - show the main steps
(use also combinations)
- run_on_video(videoFileName, cuda=False, roi_method='convexhull', roi_approach='hol', method='cpu_POS', bpm_type='welch', pre_filt=False, post_filt=True, verb=True)¶
Runs the pipeline on a specific video file.
- Parameters
videoFileName –
The path to the video file to analyse
cuda –
True - Enable computations on GPU
False - Use CPU only
roi_method –
‘convexhull’ - Uses MediaPipe’s lanmarks to compute the convex hull of the face and segment the skin
’faceparsing’ - Uses BiseNet to parse face components and segment the skin
roi_approach –
‘hol’ - Use the Holistic approach (one single ROI defined as the whole face skin region of the subject)
’patches’ - Use multiple patches as Regions of Interest
method –
One of the rPPG methods defined in pyVHR
bpm_type –
the method for computing the BPM estimate on a time window
pre_filt –
True - Use Band pass filtering on the windowed RGB signal
False - No pre-filtering
post_filt –
True - Use Band pass filtering on the estimated BVP signal
False - No post-filtering
verb –
False - not verbose
True - show the main steps
- class pyVHR.analysis.pipeline.TestResult(filename=None)¶
Bases:
object
This class is used by
pyVHR.analysis.newsuite.NewSuite
to manage the results of a test for a given video dataset on multiple rPPG methods- addData(key, value)¶
- addDataSerie()¶
- newDataSerie()¶
- saveResults(outFilename=None)¶
Save the test results in a HDF5 library that can be opened using pandas. You can analyze the results using
pyVHR.analysis.stats.StatAnalysis
pyVHR.analysis.multi_method_suite module¶
- class pyVHR.analysis.multi_method_suite.MultiMethodSuite(configFilename='default')¶
Bases:
object
This class performs tests on a video dataset using multiple rPPG methods. The suite uses these methods individually to calculate BVP and estimate BPM. After this all the BVP signals of the methods are combined into a single n-estimator signal, which is used to estimate a last BPM signal. Using multiple methods together allows you to have many estimators, so it can be useful to have a more precise BPM estimate. You can customize all the parameters using a configuration file (.cfg); in the analysis module you can find an example of cfg file named “multi_method_cfg.cfg”.
- parse_cfg(configFilename)¶
parses the given configuration file for loading the test’s parameters.
- Parameters
configFilename – configuation file (.cfg) name of path .
- start(verb=0)¶
Runs the tests as specified in the loaded config file.
- Parameters
verb –
0 - not verbose
1 - show the main steps
(use also combinations)
- class pyVHR.analysis.multi_method_suite.TestResult(filename=None)¶
Bases:
object
This class is used by
pyVHR.analysis.multi_method_suite.MultiMethodSuite
to manage the results of a test for a given video dataset on multiple rPPG methods- addData(key, value)¶
- addDataSerie()¶
- newDataSerie()¶
- saveResults(outFilename=None)¶
Save the test results in a HDF5 library that can be opened using pandas. You can analyze the results using
pyVHR.analysis.stats.StatAnalysis
pyVHR.analysis.stats module¶
- class pyVHR.analysis.stats.StatAnalysis(filepath, join_data=False, remove_ouliers=False)¶
Bases:
object
Statistic analyses for multiple datasets and multiple rPPG methods
- SignificancePlot(methods=None, metric='MAE')¶
Plots the results of hypotesis testing with the significance plot
- boxPlot(methods, metric, Y, scale, title)¶
Creates the box plot
- computeCD(avranks=None, numDatasets=None, alpha='0.05', display=True, approach='frequentist')¶
Returns critical difference for Nemenyi or Bonferroni-Dunn test according to given alpha (either alpha=”0.05” or alpha=”0.1”) for average ranks and number of tested datasets N. Test can be either “nemenyi” for for Nemenyi two tailed test or “bonferroni-dunn” for Bonferroni-Dunn test. See Orange package docs.
- displayBoxPlot(methods=None, metric='MAE', scale=None, title=True)¶
Shows the distribution of populations with box-plots
- getStatsData(methods=None, metric='MAE', printTable=True)¶
Computes statistics of data
- plot_bayesian_res(stat_result)¶
Plots the results of bayesian significance testing
- run_stats(methods=None, metric='CCC', approach='frequentist', print_report=True)¶
Runs the statistical testing procedure by automatically selecting the appropriate test for the available data.
- Parameters
methods –
The rPPG methods to analyze
metric –
‘MAE’ - Mean Absolute Error
’RMSE’ - Root Mean Squared Error
’PCC’ - Pearson’s Correlation Coefficient
’CCC’ - Concordance Correlation Coefficient
approach –
‘frequentist’ - (default) Use frequentist hypotesis tests for the analysis
’bayesian’ - Use bayesian hypotesis tests for the analysis
print_report –
‘True’ - (default) print a report of the hypotesis testing procedure
’False’ - Doesn’t print any report
- saveStatsData(methods=None, metric='MAE', outfilename='statsData.csv')¶
Saves statistics of data on disk