Skip to content
Snippets Groups Projects

Add an option to return a flat list

Merged Amir MOHAMMADI requested to merge flat into master
2 files
+ 23
14
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -130,24 +130,29 @@ class PadDatabase(BioDatabase):
@@ -130,24 +130,29 @@ class PadDatabase(BioDatabase):
######### Methods to provide common functionality ###############
######### Methods to provide common functionality ###############
#################################################################
#################################################################
def all_files(self, groups=('train', 'dev', 'eval')):
def all_files(self, groups=('train', 'dev', 'eval'), flat=False):
"""all_files(groups=('train', 'dev', 'eval')) -> files
"""Returns all files of the database, respecting the current protocol.
The files can be limited using the ``all_files_options`` in the
Returns all files of the database, respecting the current protocol.
constructor.
The files can be limited using the ``all_files_options`` in the constructor.
Parameters
**Parameters:**
----------
groups : str or tuple or None
groups : some of ``('train', 'dev', 'eval')`` or ``None``
The groups to get the data for. it should be some of ``('train',
The groups to get the data for.
'dev', 'eval')`` or ``None``
**Returns:**
flat : bool
if True, it will merge the real and attack files into one list.
 
 
Returns
 
-------
files : [:py:class:`bob.pad.base.database.PadFile`]
files : [:py:class:`bob.pad.base.database.PadFile`]
The sorted and unique list of all files of the database.
The sorted and unique list of all files of the database.
"""
"""
realset = self.sort(self.objects(protocol=self.protocol, groups=groups, purposes='real', **self.all_files_options))
realset = self.sort(self.objects(protocol=self.protocol, groups=groups, purposes='real', **self.all_files_options))
attackset = self.sort(self.objects(protocol=self.protocol, groups=groups, purposes='attack', **self.all_files_options))
attackset = self.sort(self.objects(protocol=self.protocol, groups=groups, purposes='attack', **self.all_files_options))
 
if flat:
 
return realset + attackset
return [realset, attackset]
return [realset, attackset]
def training_files(self, step=None, arrange_by_client=False):
def training_files(self, step=None, arrange_by_client=False):
Loading