diff --git a/bob/pad/face/extractor/FreqFeatures.py b/bob/pad/face/extractor/LiFeatures.py similarity index 82% rename from bob/pad/face/extractor/FreqFeatures.py rename to bob/pad/face/extractor/LiFeatures.py index 4c34996c73bcfac63e72f5f0ff76417540ad55cd..7e089b5c69c18a107b1bd4d57b3b026834603aa8 100644 --- a/bob/pad/face/extractor/FreqFeatures.py +++ b/bob/pad/face/extractor/LiFeatures.py @@ -5,14 +5,12 @@ import numpy from bob.bio.base.extractor import Extractor -import logging -logger = logging.getLogger("bob.pad.face") +from bob.core.log import setup +logger = setup("bob.pad.face") - -class FreqFeatures(Extractor, object): - """ - Compute features from pulse signals in the three color channels. +class LiFeatures(Extractor, object): + """Compute features from pulse signals in the three color channels. The features are described in the following article: @@ -27,38 +25,49 @@ class FreqFeatures(Extractor, object): } - **Parameters:** - + Attributes + ---------- framerate: int The sampling frequency of the signal (i.e the framerate ...) - nfft: int Number of points to compute the FFT - - debug: boolean + debug: bool Plot stuff + """ - def __init__(self, framerate=25, nfft=512, debug=False, **kwargs): - super(FreqFeatures, self).__init__() + def __init__(self, framerate=25, nfft=512, debug=False, **kwargs): + """Init function + + Parameters + ---------- + framerate: int + The sampling frequency of the signal (i.e the framerate ...) + nfft: int + Number of points to compute the FFT + debug: bool + Plot stuff + """ + + super(LiFeatures, self).__init__() self.framerate = framerate self.nfft = nfft self.debug = debug - def __call__(self, signal): - """ - Compute the frequency spectrum for the given signal. - **Parameters:** + def __call__(self, signal): + """Compute the frequency features for the given signal. - signal: numpy.array + Parameters + ---------- + signal: numpy.ndarray The signal - **Returns:** - - freq: numpy.array - the frequency spectrum + Returns + ------- + feature: numpy.ndarray + the computed features """ # sanity check assert signal.ndim == 2 and signal.shape[1] == 3, "You should provide 3 pulse signals" @@ -117,10 +126,8 @@ class FreqFeatures(Extractor, object): pyplot.vlines(f[last_index], ymin, ymax, color='green') pyplot.show() - if numpy.isnan(numpy.sum(feature)): logger.warn("Feature not extracted") return return feature - diff --git a/conda/meta.yaml b/conda/meta.yaml index 37ee4302a64b7d35b4c228387ddff61e5414b11e..d55a44e2acc6d3cf52487a4a9a13cc40462213f5 100644 --- a/conda/meta.yaml +++ b/conda/meta.yaml @@ -21,7 +21,7 @@ requirements: - python {{ python }} - setuptools {{ setuptools }} - six {{ six }} - - sphinx {{ sphinx }} + - sphinx - numpy {{ numpy }} - bob.extension - bob.bio.base @@ -37,6 +37,7 @@ requirements: - bob.learn.libsvm - bob.ip.dlib - bob.ip.facelandmarks + - bob.rppg.base run: - python - setuptools diff --git a/requirements.txt b/requirements.txt index 9518917ce953e255d508bf20116ce3eac9e5f92c..2e2b0219affecd11ae4d3262493d926dab28bae5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -17,4 +17,4 @@ bob.ip.facelandmarks bob.learn.libsvm bob.learn.linear scikit-learn - +bob.rppg.base