From decee648294050f1924ecd384fed71d361c29543 Mon Sep 17 00:00:00 2001 From: Guillaume HEUSCH <guillaume.heusch@idiap.ch> Date: Wed, 4 Jul 2018 14:27:42 +0200 Subject: [PATCH] [preprocessor, extractor, test] changed classe names refferring to Li ICPR 2016 algorithm --- .../{LiFeatures.py => LiSpectralFeatures.py} | 4 ++-- bob/pad/face/extractor/__init__.py | 4 ++-- .../{LiICPR2016.py => LiPulseExtraction.py} | 4 ++-- bob/pad/face/preprocessor/__init__.py | 4 ++-- bob/pad/face/test/test.py | 20 +++++++++++++------ 5 files changed, 22 insertions(+), 14 deletions(-) rename bob/pad/face/extractor/{LiFeatures.py => LiSpectralFeatures.py} (97%) rename bob/pad/face/preprocessor/{LiICPR2016.py => LiPulseExtraction.py} (98%) diff --git a/bob/pad/face/extractor/LiFeatures.py b/bob/pad/face/extractor/LiSpectralFeatures.py similarity index 97% rename from bob/pad/face/extractor/LiFeatures.py rename to bob/pad/face/extractor/LiSpectralFeatures.py index 0e25a0b0..294e0f35 100644 --- a/bob/pad/face/extractor/LiFeatures.py +++ b/bob/pad/face/extractor/LiSpectralFeatures.py @@ -9,7 +9,7 @@ from bob.core.log import setup logger = setup("bob.pad.face") -class LiFeatures(Extractor, object): +class LiSpectralFeatures(Extractor, object): """Compute features from pulse signals in the three color channels. The features are described in the following article: @@ -41,7 +41,7 @@ class LiFeatures(Extractor, object): Plot stuff """ - super(LiFeatures, self).__init__() + super(LiSpectralFeatures, self).__init__() self.framerate = framerate self.nfft = nfft self.debug = debug diff --git a/bob/pad/face/extractor/__init__.py b/bob/pad/face/extractor/__init__.py index c5ccd9b4..3a06acf2 100644 --- a/bob/pad/face/extractor/__init__.py +++ b/bob/pad/face/extractor/__init__.py @@ -2,7 +2,7 @@ from .LBPHistogram import LBPHistogram from .ImageQualityMeasure import ImageQualityMeasure from .FrameDiffFeatures import FrameDiffFeatures -from .LiFeatures import LiFeatures +from .LiSpectralFeatures import LiSpectralFeatures from .LTSS import LTSS from .PPGSecure import PPGSecure @@ -28,7 +28,7 @@ __appropriate__( LBPHistogram, ImageQualityMeasure, FrameDiffFeatures, - LiFeatures, + LiSpectralFeatures, LTSS, PPGSecure, ) diff --git a/bob/pad/face/preprocessor/LiICPR2016.py b/bob/pad/face/preprocessor/LiPulseExtraction.py similarity index 98% rename from bob/pad/face/preprocessor/LiICPR2016.py rename to bob/pad/face/preprocessor/LiPulseExtraction.py index 3e946ea4..6a4a5899 100644 --- a/bob/pad/face/preprocessor/LiICPR2016.py +++ b/bob/pad/face/preprocessor/LiPulseExtraction.py @@ -17,7 +17,7 @@ from bob.rppg.cvpr14.filter_utils import detrend from bob.rppg.cvpr14.filter_utils import average -class LiICPR2016(Preprocessor): +class LiPulseExtraction(Preprocessor): """Extract pulse signal from a video sequence. The pulse is extracted according to a simplified version of Li's CVPR 14 algorithm. @@ -70,7 +70,7 @@ class LiICPR2016(Preprocessor): Plot some stuff """ - super(LiICPR2016, self).__init__(**kwargs) + super(LiPulseExtraction, self).__init__(**kwargs) self.indent = indent self.lambda_ = lambda_ self.window = window diff --git a/bob/pad/face/preprocessor/__init__.py b/bob/pad/face/preprocessor/__init__.py index 3a094387..4badf05c 100644 --- a/bob/pad/face/preprocessor/__init__.py +++ b/bob/pad/face/preprocessor/__init__.py @@ -2,7 +2,7 @@ from .FaceCropAlign import FaceCropAlign from .FrameDifference import FrameDifference from .VideoSparseCoding import VideoSparseCoding -from .LiICPR2016 import LiICPR2016 +from .LiPulseExtraction import LiPulseExtraction from .Chrom import Chrom from .SSR import SSR from .PPGSecure import PPGSecure @@ -29,7 +29,7 @@ __appropriate__( FaceCropAlign, FrameDifference, VideoSparseCoding, - LiICPR2016, + LiPulseExtraction, Chrom, SSR, PPGSecure, diff --git a/bob/pad/face/test/test.py b/bob/pad/face/test/test.py index 07182ec4..f7c7ce29 100644 --- a/bob/pad/face/test/test.py +++ b/bob/pad/face/test/test.py @@ -28,13 +28,13 @@ from ..extractor import LBPHistogram from ..extractor import ImageQualityMeasure -from ..preprocessor import LiICPR2016 +from ..preprocessor import LiPulseExtraction from ..preprocessor import Chrom from ..preprocessor import PPGSecure as PPGPreprocessor from ..preprocessor import SSR from ..extractor import LTSS -from ..extractor import LiFeatures +from ..extractor import LiSpectralFeatures from ..extractor import PPGSecure as PPGExtractor @@ -381,7 +381,7 @@ def convert_array_to_list_of_frame_cont(data): return frame_container_list -def test_preprocessor_LiICPR2016(): +def test_preprocessor_LiPulseExtraction(): """ Test the pulse extraction using Li's ICPR 2016 algorithm. """ @@ -389,7 +389,7 @@ def test_preprocessor_LiICPR2016(): annotations = {'topleft': (95, 155), 'bottomright': (215, 265)} video, annotations = convert_image_to_video_data(image, annotations, 100) - preprocessor = LiICPR2016(debug=False) + preprocessor = LiPulseExtraction(debug=False) pulse = preprocessor(video, annotations) assert pulse.shape == (100, 3) @@ -421,6 +421,8 @@ def test_preprocessor_PPGSecure(): def test_preprocessor_SSR(): + """ Test the pulse extraction using SSR algorithm. + """ image = load(datafile('test_image.png', 'bob.pad.face.test')) annotations = {'topleft': (95, 155), 'bottomright': (215, 265)} @@ -432,6 +434,8 @@ def test_preprocessor_SSR(): def test_extractor_LTSS(): + """ Test Long Term Spectrum Statistics (LTSS) Feature Extractor + """ # "pulse" in 3 color channels data = np.random.random((200, 3)) @@ -448,17 +452,21 @@ def test_extractor_LTSS(): assert features.shape[0] == 33*2 -def test_extractor_LiFeatures(): +def test_extractor_LiSpectralFeatures(): + """ Test Li's ICPR 2016 Spectral Feature Extractor + """ # "pulse" in 3 color channels data = np.random.random((200, 3)) - extractor = LiFeatures() + extractor = LiSpectralFeatures() features = extractor(data) assert features.shape[0] == 6 def test_extractor_PPGSecure(): + """ Test PPGSecure Spectral Feature Extractor + """ # 5 "pulses" data = np.random.random((200, 5)) -- GitLab