Skip to content
Snippets Groups Projects
Commit caac10bf authored by Guillaume HEUSCH's avatar Guillaume HEUSCH
Browse files

[conda] added bob.rppg.base

parent 6751c7be
No related branches found
No related tags found
1 merge request!53WIP: rPPG as features for PAD
Pipeline #
......@@ -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
......@@ -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
......
......@@ -17,4 +17,4 @@ bob.ip.facelandmarks
bob.learn.libsvm
bob.learn.linear
scikit-learn
bob.rppg.base
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment