From 2a3cadc722dfc52cbd3eedd3480d6ebfd4c3a88c Mon Sep 17 00:00:00 2001
From: Guillaume HEUSCH <guillaume.heusch@idiap.ch>
Date: Tue, 3 Jul 2018 14:57:33 +0200
Subject: [PATCH] [test] added test for pulse-based extractor

---
 bob/pad/face/test/test.py | 63 +++++++++++++++++++++++++++++----------
 1 file changed, 47 insertions(+), 16 deletions(-)

diff --git a/bob/pad/face/test/test.py b/bob/pad/face/test/test.py
index dee19513..0bf7555c 100644
--- a/bob/pad/face/test/test.py
+++ b/bob/pad/face/test/test.py
@@ -33,6 +33,10 @@ from ..preprocessor import Chrom
 from ..preprocessor import PPGSecure
 from ..preprocessor import SSR
 
+from ..extractor import LTSS
+from ..extractor import LiFeatures
+from ..extractor import PPGSecure
+
 
 from ..preprocessor.FaceCropAlign import detect_face_landmarks_in_image
 
@@ -379,7 +383,7 @@ def convert_array_to_list_of_frame_cont(data):
 
 def test_preprocessor_LiICPR2016():
       preprocessor = LiICPR2016()
-      data = np.random((10, 3, 10, 10))
+      data = np.random.random((10, 3, 10, 10))
       frames = bob.bio.video.FrameContainer()
       for i in range(data.shape[0])
           frames.add(i, data[i])
@@ -391,7 +395,7 @@ def test_preprocessor_LiICPR2016():
 
 def test_preprocessor_Chrom():
       preprocessor = Chrom()
-      data = np.random((10, 3, 10, 10))
+      data = np.random.random((10, 3, 10, 10))
       frames = bob.bio.video.FrameContainer()
       for i in range(data.shape[0])
           frames.add(i, data[i])
@@ -401,23 +405,50 @@ def test_preprocessor_Chrom():
 
 
 def test_preprocessor_PPGSecure():
-    preprocessor = PPGSecure()
-    data = np.random((10, 3, 10, 10))
-    frames = bob.bio.video.FrameContainer()
-    for i in range(data.shape[0])
-        frames.add(i, data[i])
-    pulse = preprocessor(frames)
+      preprocessor = PPGSecure()
+      data = np.random.random((10, 3, 10, 10))
+      frames = bob.bio.video.FrameContainer()
+      for i in range(data.shape[0])
+          frames.add(i, data[i])
+      pulse = preprocessor(frames)
 
-    assert pulse.shape == (5, 10)
+      assert pulse.shape == (5, 10)
 
 
 def test_preprocessor_SSR():
-    preprocessor = SSR()
-    data = np.random((10, 3, 10, 10))
-    frames = bob.bio.video.FrameContainer()
-    for i in range(data.shape[0])
-      frames.add(i, data[i])
-    pulse = preprocessor(frames)
+      preprocessor = SSR()
+      data = np.random.random((10, 3, 10, 10))
+      frames = bob.bio.video.FrameContainer()
+      for i in range(data.shape[0])
+          frames.add(i, data[i])
+      pulse = preprocessor(frames)
+
+      assert pulse.shape[0] == 10
 
-    assert pulse.shape[0] == 10
 
+def test_extractor_LTSS():
+      data = np.random.random((200, 3))
+      
+      extractor = LTSS(concat=True)
+      features = extractor(data)
+      assert features.shape[0] == 32*3
+      
+      extractor = LTSS(concat=False)
+      features = extractor(data)
+      assert features.shape[0] == 32
+
+
+def test_extractor_LiFeatures():
+      data = np.random.random((200, 3))
+      
+      extractor = LiFeatures()
+      features = extractor(data)
+      assert features.shape[0] == 6 
+     
+
+def test_extractor_PPGSecure():
+      data = np.random.random((200, 3))
+      
+      extractor = PPGSecure()
+      features = extractor(data)
+      assert features.shape[0] == 5*16
-- 
GitLab