From caac10bf9a45541d35a8f52a5706fa14c2db97e7 Mon Sep 17 00:00:00 2001 From: Guillaume HEUSCH <guillaume.heusch@idiap.ch> Date: Thu, 28 Jun 2018 12:07:41 +0200 Subject: [PATCH] [conda] added bob.rppg.base --- .../{FreqFeatures.py => LiFeatures.py} | 55 +++++++++++-------- conda/meta.yaml | 3 +- requirements.txt | 2 +- 3 files changed, 34 insertions(+), 26 deletions(-) rename bob/pad/face/extractor/{FreqFeatures.py => LiFeatures.py} (82%) 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 4c34996c..7e089b5c 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 37ee4302..d55a44e2 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 9518917c..2e2b0219 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 -- GitLab