Python API¶
This section includes information for using the Python API of bob.db.verification.utils
.
Classes¶
-
class
bob.db.verification.utils.
File
(client_id, path, file_id=None)[source]¶ Bases:
object
Abstract base class that defines basic properties of File objects
Constructor Documentation
Initialize the File object with the minimum required data.
Parameters:
- client_id : various type
- The id of the client, this file belongs to. The type of it is dependent on your implementation. If you use an SQL database, this should be an SQL type like Integer or String.
- path : str
- The path of this file, relative to the basic directory. If you use an SQL database, this should be the SQL type String. Please do not specify any file extensions.
- file_id : various type
- The id of the file. The type of it is dependent on your implementation. If you use an SQL database, this should be an SQL type like Integer or String. If you are using an automatically determined file id, you can skip selecting the file id.
-
client_id
= None¶ The id of the client that belongs to this file.
-
path
= None¶ The relative path including the file name, but excluding the file name extension
-
id
= None¶ A unique identifier of the file.
-
make_path
(directory=None, extension=None)[source]¶ Wraps the current path so that a complete path is formed
Keyword parameters:
- directory : str or None
- An optional directory name that will be prefixed to the returned result.
- extension : str or None
- An optional extension that will be suffixed to the returned filename.
The extension normally includes the leading
.
character as in.jpg
or.hdf5
.
Returns a string containing the newly generated file path.
-
save
(data, directory=None, extension='.hdf5', create_directories=True)[source]¶ Saves the input data at the specified location and using the given extension.
Keyword parameters:
- data : various types
- The data blob to be saved (normally a
numpy.ndarray
). - directory : str or None
- If not empty or None, this directory is prefixed to the final file destination
- extension : str or None
- The extension of the filename. This extension will control the type of output and the codec for saving the input blob.
- create_directories : bool
- Should the directory structure be created (if necessary) before writing the data?
-
class
bob.db.verification.utils.
Database
(original_directory=None, original_extension=None)[source]¶ Bases:
object
Abstract base class that defines the minimum required API for querying verification databases.
Contructor Documentation
The constructor tests if all implemented functions at least take the desired arguments. When
original_directory
andoriginal_extension
are specified, theoriginal_file_name()
method will be able to return the full path of the original files.Keyword arguments:
- original_directory : str or None
- The base directory, where the original data files can be found
- original_extension : str or None
- The file name extension of the original files (e.g.,
'.png'
or'.avi'
)
-
groups
(protocol=None, **kwargs)[source]¶ This function returns the list of groups for this database.
- protocol : str
- The protocol for which the groups should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
Returns: a list of groups
-
model_ids
(groups=None, protocol=None, **kwargs)[source]¶ This function returns the ids of the models of the given groups for the given protocol.
Keyword parameters:
- groups : str or [str]
- The groups of which the model ids should be returned. Usually, groups are one or more elements of (‘world’, ‘dev’, ‘eval’)
- protocol : str
- The protocol for which the model ids should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
-
objects
(groups=None, protocol=None, purposes=None, model_ids=None, **kwargs)[source]¶ This function returns lists of File objects, which fulfill the given restrictions.
Keyword parameters:
- groups : str or [str]
- The groups of which the clients should be returned. Usually, groups are one or more elements of (‘world’, ‘dev’, ‘eval’)
- protocol
- The protocol for which the clients should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
- purposes : str or [str]
- The purposes for which File objects should be retrieved. Usually, purposes are one of (‘enroll’, ‘probe’).
- model_ids : [various type]
- The model ids for which the File objects should be retrieved. What defines a ‘model id’ is dependent on the database. In cases, where there is only one model per client, model ids and client ids are identical. In cases, where there is one model per file, model ids and file ids are identical. But, there might also be other cases.
-
annotations
(file)[source]¶ This function returns the annotations for the given file id as a dictionary.
Keyword parameters:
- file :
- The File object you want to retrieve the annotations for,
- Return value:
- A dictionary of annotations, for face images usually something like {‘leye’:(le_y,le_x), ‘reye’:(re_y,re_x), ...}, or None if there are no annotations for the given file ID (which is the case in this base class implementation).
bob.db.verification.utils.File
or one of its derivatives
-
provides_file_set_for_protocol
(protocol=None)[source]¶ Returns True if the given protocol specifies file sets for probes, instead of a single probe file. In this default implementation, False is returned, throughout. If you need different behavior, please overload this function in your derived class.
-
uniquify
(file_list)[source]¶ Sorts the given list of File objects and removes duplicates from it.
Keyword parameters:
- file_list : [
- A list of File objects to be handled. Also other objects can be handled, as long as they are sortable.
- Returns
- A sorted copy of the given
file_list
with the duplicates removed.
File
]
-
check_parameters_for_validity
(parameters, parameter_description, valid_parameters, default_parameters=None)[source]¶ Checks the given parameters for validity, i.e., if they are contained in the set of valid parameters. It also assures that the parameters form a tuple or a list. If parameters is ‘None’ or empty, the default_parameters will be returned (if default_parameters is omitted, all valid_parameters are returned).
This function will return a tuple or list of parameters, or raise a ValueError.
Keyword parameters:
- parameters : str, [str] or None
- The parameters to be checked. Might be a string, a list/tuple of strings, or None.
- parameter_description : str
- A short description of the parameter. This will be used to raise an exception in case the parameter is not valid.
- valid_parameters : [str]
- A list/tuple of valid values for the parameters.
- default_parameters : [str] or None
- The list/tuple of default parameters that will be returned in case parameters is None or empty. If omitted, all valid_parameters are used.
-
check_parameter_for_validity
(parameter, parameter_description, valid_parameters, default_parameter=None)[source]¶ Checks the given parameter for validity, i.e., if it is contained in the set of valid parameters. If the parameter is ‘None’ or empty, the default_parameter will be returned, in case it is specified, otherwise a ValueError will be raised.
This function will return the parameter after the check tuple or list of parameters, or raise a ValueError.
Keyword parameters:
- parameter : str
- The single parameter to be checked. Might be a string or None.
- parameter_description : str
- A short description of the parameter. This will be used to raise an exception in case the parameter is not valid.
- valid_parameters : [str]
- A list/tuple of valid values for the parameters.
- default_parameters : [str] or None
- The default parameter that will be returned in case parameter is None or empty. If omitted and parameter is empty, a ValueError is raised.
-
original_file_name
(file, check_existence=True)[source]¶ This function returns the original file name for the given File object.
Keyword parameters:
- file :
- The File objects for which the file name should be retrieved
- check_existence : bool
- Check if the original file exists?
- Return value : str
- The original file name for the given File object
File
or a derivative
-
original_file_names
(files, check_existence=True)[source]¶ This function returns the list of original file names for the given list of File objects.
Keyword parameters:
- files : [
- The list of File objects for which the file names should be retrieved
- check_existence : bool
- Check if the original files exists?
- Return value : [str]
- The original file names for the given File objects, in the same order.
File
]
-
file_names
(files, directory, extension)[source]¶ This function returns the list of original file names for the given list of File objects.
Keyword parameters:
- files : [
- The list of File objects for which the file names should be retrieved
- directory : str
- The base directory where the files are stored
- extension : str
- The file name extension of the files
- Return value : [str]
- The file names for the given File objects, in the same order.
File
]
-
all_files
(**kwargs)[source]¶ Returns the list of all File objects that satisfy your query. For possible keyword arguments, please check the
objects()
function.
-
training_files
(protocol=None, **kwargs)[source]¶ Returns the list of all training (world) File objects that satisfy your query. For possible keyword arguments, please check the
objects()
function.
-
test_files
(protocol=None, groups='dev', **kwargs)[source]¶ Returns the list of all test File objects of the given groups that satisfy your query. Test objects are all File objects that serve either for enrollment or probing. For possible keyword arguments, please check the
objects()
function.
-
enroll_files
(protocol=None, model_id=None, groups='dev', **kwargs)[source]¶ Returns the list of enrollment File objects from the given model id of the given protocol for the given groups that satisfy your query. If the model_id is None (the default), enrollment files for all models are returned. For possible keyword arguments, please check the
objects()
function.
-
probe_files
(protocol=None, model_id=None, groups='dev', **kwargs)[source]¶ Returns the list of probe File objects to probe the model with the given model id of the given protocol for the given groups that satisfy your query. If the model_id is None (the default), all possible probe files are returned. For possible keyword arguments, please check the
objects()
function.
-
get_client_id_from_model_id
(model_id, **kwargs)[source]¶ Return the client id associated with the given model id. In this base class implementation, it is assumed that only one model is enrolled for each client and, thus, client id and model id are identical. All key word arguments are ignored. Please override this function in derived class implementations to change this behavior.
-
class
bob.db.verification.utils.
SQLiteDatabase
(sqlite_file, file_class, **kwargs)[source]¶ Bases:
bob.db.verification.utils.database.Database
This class can be used for handling SQL databases. It opens an SQL database in a read-only mode and keeps it opened during the whole session. Since this class is based on the
bob.db.verification.utils.Database
class, it is abstract and you have to implement the abstract methods of that class.Contructor Documentation
Opens a connection to the given SQLite file and keeps it open through the whole session.
Keyword parameters:
- sqlite_file : str
- The file name (including full path) of the SQLite file to read or generate.
- file_class : a class instance
- The
File
class, which needs to be derived frombob.db.verification.utils.File
. This is required to be able toquery()
the databases later on.
Other keyword arguments passed to the
bob.db.verification.utils.Database
constructor.-
files
(ids, preserve_order=True)[source]¶ Returns a list of
File
objects with the given file idsKeyword Parameters:
- ids : [various type]
- The ids of the object in the database table “file”. This object should be a python iterable (such as a tuple or list).
- preserve_order : bool
- If True (the default) the order of elements is preserved, but the execution time increases.
Returns a list (that may be empty) of
File
objects.
-
paths
(ids, prefix=None, suffix=None, preserve_order=True)[source]¶ Returns a full file paths considering particular file ids, a given directory and an extension
Keyword Parameters:
- ids : [various type]
- The ids of the object in the database table “file”. This object should be a python iterable (such as a tuple or list).
- prefix : str or None
- The bit of path to be prepended to the filename stem
- suffix : str or None
- The extension determines the suffix that will be appended to the filename stem.
- preserve_order : bool
- If True (the default) the order of elements is preserved, but the execution time increases.
Returns a list (that may be empty) of the fully constructed paths given the file ids.
-
reverse
(paths, preserve_order=True)[source]¶ Reverses the lookup: from certain paths, return a list of File objects
Keyword Parameters:
- paths : [str]
- The filename stems to query for. This object should be a python iterable (such as a tuple or list)
- preserve_order : True
- If True (the default) the order of elements is preserved, but the execution time increases.
Returns a list (that may be empty).
-
all_files
(**kwargs)¶ Returns the list of all File objects that satisfy your query. For possible keyword arguments, please check the
objects()
function.
-
annotations
(file)¶ This function returns the annotations for the given file id as a dictionary.
Keyword parameters:
- file :
- The File object you want to retrieve the annotations for,
- Return value:
- A dictionary of annotations, for face images usually something like {‘leye’:(le_y,le_x), ‘reye’:(re_y,re_x), ...}, or None if there are no annotations for the given file ID (which is the case in this base class implementation).
bob.db.verification.utils.File
or one of its derivatives
-
check_parameter_for_validity
(parameter, parameter_description, valid_parameters, default_parameter=None)¶ Checks the given parameter for validity, i.e., if it is contained in the set of valid parameters. If the parameter is ‘None’ or empty, the default_parameter will be returned, in case it is specified, otherwise a ValueError will be raised.
This function will return the parameter after the check tuple or list of parameters, or raise a ValueError.
Keyword parameters:
- parameter : str
- The single parameter to be checked. Might be a string or None.
- parameter_description : str
- A short description of the parameter. This will be used to raise an exception in case the parameter is not valid.
- valid_parameters : [str]
- A list/tuple of valid values for the parameters.
- default_parameters : [str] or None
- The default parameter that will be returned in case parameter is None or empty. If omitted and parameter is empty, a ValueError is raised.
-
check_parameters_for_validity
(parameters, parameter_description, valid_parameters, default_parameters=None)¶ Checks the given parameters for validity, i.e., if they are contained in the set of valid parameters. It also assures that the parameters form a tuple or a list. If parameters is ‘None’ or empty, the default_parameters will be returned (if default_parameters is omitted, all valid_parameters are returned).
This function will return a tuple or list of parameters, or raise a ValueError.
Keyword parameters:
- parameters : str, [str] or None
- The parameters to be checked. Might be a string, a list/tuple of strings, or None.
- parameter_description : str
- A short description of the parameter. This will be used to raise an exception in case the parameter is not valid.
- valid_parameters : [str]
- A list/tuple of valid values for the parameters.
- default_parameters : [str] or None
- The list/tuple of default parameters that will be returned in case parameters is None or empty. If omitted, all valid_parameters are used.
-
enroll_files
(protocol=None, model_id=None, groups='dev', **kwargs)¶ Returns the list of enrollment File objects from the given model id of the given protocol for the given groups that satisfy your query. If the model_id is None (the default), enrollment files for all models are returned. For possible keyword arguments, please check the
objects()
function.
-
file_names
(files, directory, extension)¶ This function returns the list of original file names for the given list of File objects.
Keyword parameters:
- files : [
- The list of File objects for which the file names should be retrieved
- directory : str
- The base directory where the files are stored
- extension : str
- The file name extension of the files
- Return value : [str]
- The file names for the given File objects, in the same order.
File
]
-
get_client_id_from_model_id
(model_id, **kwargs)¶ Return the client id associated with the given model id. In this base class implementation, it is assumed that only one model is enrolled for each client and, thus, client id and model id are identical. All key word arguments are ignored. Please override this function in derived class implementations to change this behavior.
-
groups
(protocol=None, **kwargs)¶ This function returns the list of groups for this database.
- protocol : str
- The protocol for which the groups should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
Returns: a list of groups
-
model_ids
(groups=None, protocol=None, **kwargs)¶ This function returns the ids of the models of the given groups for the given protocol.
Keyword parameters:
- groups : str or [str]
- The groups of which the model ids should be returned. Usually, groups are one or more elements of (‘world’, ‘dev’, ‘eval’)
- protocol : str
- The protocol for which the model ids should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
-
objects
(groups=None, protocol=None, purposes=None, model_ids=None, **kwargs)¶ This function returns lists of File objects, which fulfill the given restrictions.
Keyword parameters:
- groups : str or [str]
- The groups of which the clients should be returned. Usually, groups are one or more elements of (‘world’, ‘dev’, ‘eval’)
- protocol
- The protocol for which the clients should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
- purposes : str or [str]
- The purposes for which File objects should be retrieved. Usually, purposes are one of (‘enroll’, ‘probe’).
- model_ids : [various type]
- The model ids for which the File objects should be retrieved. What defines a ‘model id’ is dependent on the database. In cases, where there is only one model per client, model ids and client ids are identical. In cases, where there is one model per file, model ids and file ids are identical. But, there might also be other cases.
-
original_file_name
(file, check_existence=True)¶ This function returns the original file name for the given File object.
Keyword parameters:
- file :
- The File objects for which the file name should be retrieved
- check_existence : bool
- Check if the original file exists?
- Return value : str
- The original file name for the given File object
File
or a derivative
-
original_file_names
(files, check_existence=True)¶ This function returns the list of original file names for the given list of File objects.
Keyword parameters:
- files : [
- The list of File objects for which the file names should be retrieved
- check_existence : bool
- Check if the original files exists?
- Return value : [str]
- The original file names for the given File objects, in the same order.
File
]
-
probe_files
(protocol=None, model_id=None, groups='dev', **kwargs)¶ Returns the list of probe File objects to probe the model with the given model id of the given protocol for the given groups that satisfy your query. If the model_id is None (the default), all possible probe files are returned. For possible keyword arguments, please check the
objects()
function.
-
provides_file_set_for_protocol
(protocol=None)¶ Returns True if the given protocol specifies file sets for probes, instead of a single probe file. In this default implementation, False is returned, throughout. If you need different behavior, please overload this function in your derived class.
-
test_files
(protocol=None, groups='dev', **kwargs)¶ Returns the list of all test File objects of the given groups that satisfy your query. Test objects are all File objects that serve either for enrollment or probing. For possible keyword arguments, please check the
objects()
function.
-
training_files
(protocol=None, **kwargs)¶ Returns the list of all training (world) File objects that satisfy your query. For possible keyword arguments, please check the
objects()
function.
-
uniquify
(file_list)¶ Sorts the given list of File objects and removes duplicates from it.
Keyword parameters:
- file_list : [
- A list of File objects to be handled. Also other objects can be handled, as long as they are sortable.
- Returns
- A sorted copy of the given
file_list
with the duplicates removed.
File
]
-
class
bob.db.verification.utils.
ZTDatabase
(**kwargs)[source]¶ Bases:
bob.db.verification.utils.database.Database
This class defines another set of abstract functions that need to be implemented if your database provides the interface for computing scores used for ZT-normalization.
Construtctor Documentation
This constructor tests if all implemented functions take the correct arguments. All keyword parameters will be passed unaltered to the
bob.db.verification.utils.Database
constructor.-
tmodel_ids
(groups=None, protocol=None, **kwargs)[source]¶ This function returns the ids of the T-Norm models of the given groups for the given protocol.
Keyword parameters:
- groups : str or [str]
- The groups of which the model ids should be returned. Usually, groups are one or more elements of (‘dev’, ‘eval’)
- protocol : str
- The protocol for which the model ids should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
-
tobjects
(groups=None, protocol=None, model_ids=None, **kwargs)[source]¶ This function returns the File objects of the T-Norm models of the given groups for the given protocol and the given model ids.
Keyword parameters:
- groups : str or [str]
- The groups of which the model ids should be returned. Usually, groups are one or more elements of (‘dev’, ‘eval’)
- protocol : str
- The protocol for which the model ids should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
- model_ids : [various type]
- The model ids for which the File objects should be retrieved. What defines a ‘model id’ is dependent on the database. In cases, where there is only one model per client, model ids and client ids are identical. In cases, where there is one model per file, model ids and file ids are identical. But, there might also be other cases.
-
zobjects
(groups=None, protocol=None, **kwargs)[source]¶ This function returns the File objects of the Z-Norm impostor files of the given groups for the given protocol.
Keyword parameters:
- groups : str or [str]
- The groups of which the model ids should be returned. Usually, groups are one or more elements of (‘dev’, ‘eval’)
- protocol : str
- The protocol for which the model ids should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
-
t_model_ids
(protocol, groups='dev', **kwargs)[source]¶ Returns the list of model ids used for T-Norm of the given protocol for the given group that satisfy your query. For possible keyword arguments, please check the
tmodel_ids()
function.
-
t_enroll_files
(protocol, model_id, groups='dev', **kwargs)[source]¶ Returns the list of T-Norm model enrollment File objects from the given model id of the given protocol for the given group that satisfy your query. For possible keyword arguments, please check the
tobjects()
function.
-
all_files
(**kwargs)¶ Returns the list of all File objects that satisfy your query. For possible keyword arguments, please check the
objects()
function.
-
annotations
(file)¶ This function returns the annotations for the given file id as a dictionary.
Keyword parameters:
- file :
- The File object you want to retrieve the annotations for,
- Return value:
- A dictionary of annotations, for face images usually something like {‘leye’:(le_y,le_x), ‘reye’:(re_y,re_x), ...}, or None if there are no annotations for the given file ID (which is the case in this base class implementation).
bob.db.verification.utils.File
or one of its derivatives
-
check_parameter_for_validity
(parameter, parameter_description, valid_parameters, default_parameter=None)¶ Checks the given parameter for validity, i.e., if it is contained in the set of valid parameters. If the parameter is ‘None’ or empty, the default_parameter will be returned, in case it is specified, otherwise a ValueError will be raised.
This function will return the parameter after the check tuple or list of parameters, or raise a ValueError.
Keyword parameters:
- parameter : str
- The single parameter to be checked. Might be a string or None.
- parameter_description : str
- A short description of the parameter. This will be used to raise an exception in case the parameter is not valid.
- valid_parameters : [str]
- A list/tuple of valid values for the parameters.
- default_parameters : [str] or None
- The default parameter that will be returned in case parameter is None or empty. If omitted and parameter is empty, a ValueError is raised.
-
check_parameters_for_validity
(parameters, parameter_description, valid_parameters, default_parameters=None)¶ Checks the given parameters for validity, i.e., if they are contained in the set of valid parameters. It also assures that the parameters form a tuple or a list. If parameters is ‘None’ or empty, the default_parameters will be returned (if default_parameters is omitted, all valid_parameters are returned).
This function will return a tuple or list of parameters, or raise a ValueError.
Keyword parameters:
- parameters : str, [str] or None
- The parameters to be checked. Might be a string, a list/tuple of strings, or None.
- parameter_description : str
- A short description of the parameter. This will be used to raise an exception in case the parameter is not valid.
- valid_parameters : [str]
- A list/tuple of valid values for the parameters.
- default_parameters : [str] or None
- The list/tuple of default parameters that will be returned in case parameters is None or empty. If omitted, all valid_parameters are used.
-
enroll_files
(protocol=None, model_id=None, groups='dev', **kwargs)¶ Returns the list of enrollment File objects from the given model id of the given protocol for the given groups that satisfy your query. If the model_id is None (the default), enrollment files for all models are returned. For possible keyword arguments, please check the
objects()
function.
-
file_names
(files, directory, extension)¶ This function returns the list of original file names for the given list of File objects.
Keyword parameters:
- files : [
- The list of File objects for which the file names should be retrieved
- directory : str
- The base directory where the files are stored
- extension : str
- The file name extension of the files
- Return value : [str]
- The file names for the given File objects, in the same order.
File
]
-
get_client_id_from_model_id
(model_id, **kwargs)¶ Return the client id associated with the given model id. In this base class implementation, it is assumed that only one model is enrolled for each client and, thus, client id and model id are identical. All key word arguments are ignored. Please override this function in derived class implementations to change this behavior.
-
groups
(protocol=None, **kwargs)¶ This function returns the list of groups for this database.
- protocol : str
- The protocol for which the groups should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
Returns: a list of groups
-
model_ids
(groups=None, protocol=None, **kwargs)¶ This function returns the ids of the models of the given groups for the given protocol.
Keyword parameters:
- groups : str or [str]
- The groups of which the model ids should be returned. Usually, groups are one or more elements of (‘world’, ‘dev’, ‘eval’)
- protocol : str
- The protocol for which the model ids should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
-
objects
(groups=None, protocol=None, purposes=None, model_ids=None, **kwargs)¶ This function returns lists of File objects, which fulfill the given restrictions.
Keyword parameters:
- groups : str or [str]
- The groups of which the clients should be returned. Usually, groups are one or more elements of (‘world’, ‘dev’, ‘eval’)
- protocol
- The protocol for which the clients should be retrieved. The protocol is dependent on your database. If you do not have protocols defined, just ignore this field.
- purposes : str or [str]
- The purposes for which File objects should be retrieved. Usually, purposes are one of (‘enroll’, ‘probe’).
- model_ids : [various type]
- The model ids for which the File objects should be retrieved. What defines a ‘model id’ is dependent on the database. In cases, where there is only one model per client, model ids and client ids are identical. In cases, where there is one model per file, model ids and file ids are identical. But, there might also be other cases.
-
original_file_name
(file, check_existence=True)¶ This function returns the original file name for the given File object.
Keyword parameters:
- file :
- The File objects for which the file name should be retrieved
- check_existence : bool
- Check if the original file exists?
- Return value : str
- The original file name for the given File object
File
or a derivative
-
original_file_names
(files, check_existence=True)¶ This function returns the list of original file names for the given list of File objects.
Keyword parameters:
- files : [
- The list of File objects for which the file names should be retrieved
- check_existence : bool
- Check if the original files exists?
- Return value : [str]
- The original file names for the given File objects, in the same order.
File
]
-
probe_files
(protocol=None, model_id=None, groups='dev', **kwargs)¶ Returns the list of probe File objects to probe the model with the given model id of the given protocol for the given groups that satisfy your query. If the model_id is None (the default), all possible probe files are returned. For possible keyword arguments, please check the
objects()
function.
-
provides_file_set_for_protocol
(protocol=None)¶ Returns True if the given protocol specifies file sets for probes, instead of a single probe file. In this default implementation, False is returned, throughout. If you need different behavior, please overload this function in your derived class.
-
test_files
(protocol=None, groups='dev', **kwargs)¶ Returns the list of all test File objects of the given groups that satisfy your query. Test objects are all File objects that serve either for enrollment or probing. For possible keyword arguments, please check the
objects()
function.
-
training_files
(protocol=None, **kwargs)¶ Returns the list of all training (world) File objects that satisfy your query. For possible keyword arguments, please check the
objects()
function.
-
uniquify
(file_list)¶ Sorts the given list of File objects and removes duplicates from it.
Keyword parameters:
- file_list : [
- A list of File objects to be handled. Also other objects can be handled, as long as they are sortable.
- Returns
- A sorted copy of the given
file_list
with the duplicates removed.
File
]
-
Functions¶
-
bob.db.verification.utils.
read_annotation_file
(file_name, annotation_type)[source]¶ This function provides default functionality to read annotation files. It returns a dictionary with the keypoint name as key and the position (y,x) as value, and maybe some additional annotations.
Keyword Parameters:
- file_name : str
- The full path of the annotation file to read
- annotation_type : str
The type of the annotation file that should be read. The following annotation_types are supported:
- ‘eyecenter’: The file contains a single row with four entries: ‘re_x re_y le_x le_y’
- ‘named’: The file contains named annotations, one per line, e.g.: ‘reye re_x re_y’ or ‘pose 25.7’
- ‘idiap’: The file contains enumerated annotations, one per line, e.g.: ‘1 key1_x key1_y’, and maybe some additional annotations like gender, age, ...