From cb61d1fcb17e69fcae5064b7b9ffea57ac33e221 Mon Sep 17 00:00:00 2001
From: Ketan Kotwal <ketan.kotwal@idiap.ch>
Date: Thu, 28 May 2020 13:56:24 +0200
Subject: [PATCH] remove frameindexes while loading

---
 bob/paper/nir_patch_pooling/database/mlfp.py             | 6 ++++--
 .../nir_patch_pooling/script/convert_mlfp_database.py    | 9 +++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/bob/paper/nir_patch_pooling/database/mlfp.py b/bob/paper/nir_patch_pooling/database/mlfp.py
index 3b6473a..9046e2c 100644
--- a/bob/paper/nir_patch_pooling/database/mlfp.py
+++ b/bob/paper/nir_patch_pooling/database/mlfp.py
@@ -39,8 +39,10 @@ class File(VideoPadFile):
         hdf_file = h5py.File(path)
         
         fc = FrameContainer()
-        
-        for idx, frame_data in enumerate(hdf_file.keys()):
+        frame_keys = list(hdf_file.keys())
+        frame_keys.remove("FrameIndexes")
+
+        for idx, frame_data in enumerate(frame_keys):
             frame = hdf_file[frame_data]["array"].value
             fc.add(idx, frame, None)
 
diff --git a/bob/paper/nir_patch_pooling/script/convert_mlfp_database.py b/bob/paper/nir_patch_pooling/script/convert_mlfp_database.py
index ef4ba41..1148ac4 100755
--- a/bob/paper/nir_patch_pooling/script/convert_mlfp_database.py
+++ b/bob/paper/nir_patch_pooling/script/convert_mlfp_database.py
@@ -10,6 +10,12 @@ import os, sys
 from bob.bio.video import FrameContainer
 from bob.io.base import create_directories_safe, HDF5File
 import numpy as np
+from bob.pad.face.preprocessor.FaceCropAlign import detect_face_landmarks_in_image
+import json
+
+import logging
+logger = logging.getLogger(__name__)
+logger.setLevel(logging.INFO)
 
 frames_per_video = 20
 
@@ -51,7 +57,7 @@ class MLFPConvertor:
 
 #------------------------------------------------------------------------------
 
-    def normalize_image(self, image, n_sigma=3.0): # or 4.0
+    def normalize_image(self, image, n_sigma=4.0): # 3.0 or 4.0
 
         assert(len(image.shape)==2)
         
@@ -115,7 +121,6 @@ class MLFPConvertor:
 
         # if image is grayscale, convert to 3 channel for face detection
         if len(image.shape) == 2:
-            print (image.shape)
             image = np.repeat(image[:, :, np.newaxis], 3, axis=2)
             image = np.transpose(image, (2,0,1))
 
-- 
GitLab