From f947066fdc9c3d1f5258628b5ba7691ba9b679cf Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Thu, 1 Feb 2018 17:07:32 +0100
Subject: [PATCH] Add padfile to label. Useful for deeplearning

---
 bob/pad/base/__init__.py | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/bob/pad/base/__init__.py b/bob/pad/base/__init__.py
index c4f2695..f40abcb 100644
--- a/bob/pad/base/__init__.py
+++ b/bob/pad/base/__init__.py
@@ -6,6 +6,23 @@ from . import evaluation
 from . import script
 from . import test
 
+
+def padfile_to_label(padfile):
+  """Returns an integer presenting the label of the current sample.
+
+  Parameters
+  ----------
+  padfile : :any:`bob.pad.base.database.PadFile`
+      A pad file.
+
+  Returns
+  -------
+  bool
+      True (1) if it is a bona-fide sample, False (O) otherwise.
+  """
+  return padfile.attack_type is None
+
+
 def get_config():
   """Returns a string containing the configuration information.
   """
-- 
GitLab