Databases¶
Wrapper classes for image databases
-
class
facereclib.databases.
Database
(name, original_directory=None, original_extension=None, annotation_directory=None, annotation_extension='.pos', annotation_type=None, protocol='Default', **kwargs)[source]¶ This class represents the basic API for database access. Please use this class as a base class for your database access classes. Do not forget to call the constructor of this base class in your derived class.
Parameters to the constructor of the Database:
- name
- A unique name for the database.
- original_directory
- The directory where the original data of the database are stored.
- original_extension
- The file extension of the original data.
- annotation_directory
- The directory where the image annotations of the database are stored, if any.
- annotation_directory
- The file extension of the annotation files.
- protocol
- The name of the protocol that defines the default experimental setup for this database.
- kwargs
- Ignored extra arguments.
-
arrange_by_client
(files)[source]¶ Arranges the given list of files by client id. This function returns a list of lists of File’s.
-
client_id_from_model_id
(model_id, group='dev')[source]¶ Returns the client id for the given model id
-
enroll_files
(model_id, group='dev')[source]¶ Returns a list of enrollment File objects for the given model id and the given group
-
original_file_names
(files)[source]¶ Returns the full path of the original data of the given File objects.
-
probe_file_sets
(model_id=None, group='dev')[source]¶ Returns a list of probe FileSet object in a specific format that should be compared with the model belonging to the given model id of the specified group
-
probe_files
(model_id=None, group='dev')[source]¶ Returns a list of probe File object in a specific format that should be compared with the model belonging to the given model id of the specified group
-
sort
(files)[source]¶ Returns a sorted version of the given list of File’s (or other structures that define an ‘id’ data member). The files will be sorted according to their id, and duplicate entries will be removed.
-
class
facereclib.databases.
DatabaseBob
(database, all_files_options={}, extractor_training_options={}, projector_training_options={}, enroller_training_options={}, check_original_files_for_existence=False, **kwargs)[source]¶ Bases:
facereclib.databases.Database.Database
This class can be used whenever you have a database that follows the default Bob database interface.
Parameters of the constructor of this database:
- database
- the bob.db.___ database that provides the actual interface
- image_directory
- The directory where the original images are stored.
- image_extension
- The file extension of the original images.
- all_files_options
- Options passed to the database query used to retrieve all data.
- extractor_training_options
- Options passed to the database query used to retrieve the images for the extractor training.
- projector_training_options
- Options passed to the database query used to retrieve the images for the projector training.
- enroller_training_options
- Options passed to the database query used to retrieve the images for the enroller training.
- check_original_files_for_existence
- Enables the test for the original data files when querying the database.
- kwargs
- The arguments of the base class
-
all_files
(groups=None)[source]¶ Returns all File objects of the database for the current protocol. If the current protocol is ‘None’ (a string), None (NoneType) will be used instead
-
arrange_by_client
(files)¶ Arranges the given list of files by client id. This function returns a list of lists of File’s.
-
client_id_from_model_id
(model_id, group='dev')[source]¶ Returns the client id for the given model id.
-
enroll_files
(model_id, group='dev')[source]¶ Returns the list of enrollment File objects for the given model id.
-
file_names
(files, directory, extension)¶ Returns the full path of the given File objects.
-
original_file_names
(files)[source]¶ Returns the full path of the original data of the given File objects.
-
probe_file_sets
(model_id=None, group='dev')[source]¶ Returns the list of probe File objects (for the given model id, if given).
-
probe_files
(model_id=None, group='dev')[source]¶ Returns the list of probe File objects (for the given model id, if given).
-
sort
(files)¶ Returns a sorted version of the given list of File’s (or other structures that define an ‘id’ data member). The files will be sorted according to their id, and duplicate entries will be removed.
-
test_files
(groups=['dev'])[source]¶ Returns the test files (i.e., enrollment and probe files) for the given groups.
-
class
facereclib.databases.
DatabaseBobZT
(z_probe_options={}, **kwargs)[source]¶ Bases:
facereclib.databases.DatabaseBob.DatabaseBob
,facereclib.databases.Database.DatabaseZT
This class can be used whenever you have a database that follows the default Bob database interface defining file lists for ZT score normalization.
-
all_files
(groups=['dev'])[source]¶ Returns all File objects of the database for the current protocol. If the current protocol is ‘None’ (a string), None (NoneType) will be used instead
-
annotations
(file)¶ Returns the annotations for the given File object, if available.
-
arrange_by_client
(files)¶ Arranges the given list of files by client id. This function returns a list of lists of File’s.
-
client_id_from_model_id
(model_id, group='dev')¶ Returns the client id for the given model id.
-
client_id_from_t_model_id
(t_model_id, group='dev')¶ Returns the client id for the given T-model id. In this base class implementation, we just use the
client_id_from_model_id()
function. Overload this function if you need another behavior.
-
enroll_files
(model_id, group='dev')¶ Returns the list of enrollment File objects for the given model id.
-
file_names
(files, directory, extension)¶ Returns the full path of the given File objects.
-
model_ids
(group='dev')¶ Returns the model ids for the given group and the current protocol.
-
original_file_names
(files)¶ Returns the full path of the original data of the given File objects.
-
probe_file_sets
(model_id=None, group='dev')¶ Returns the list of probe File objects (for the given model id, if given).
-
probe_files
(model_id=None, group='dev')¶ Returns the list of probe File objects (for the given model id, if given).
-
sort
(files)¶ Returns a sorted version of the given list of File’s (or other structures that define an ‘id’ data member). The files will be sorted according to their id, and duplicate entries will be removed.
-
t_enroll_files
(model_id, group='dev')[source]¶ Returns the list of enrollment File objects for the given T-Norm model id.
-
t_model_ids
(group='dev')[source]¶ Returns the T-Norm model ids for the given group and the current protocol.
-
test_files
(groups=['dev'])¶ Returns the test files (i.e., enrollment and probe files) for the given groups.
-
training_files
(step=None, arrange_by_client=False)¶ Returns all training File objects of the database for the current protocol.
-
uses_probe_file_sets
()¶ Defines if, for the current protocol, the database uses several probe files to generate a score.
-
-
class
facereclib.databases.
DatabaseFileList
(database, **kwargs)[source]¶ Bases:
facereclib.databases.DatabaseBob.DatabaseBobZT
This class should be used whenever you have an
bob.db.verification.filelist.Database`
.Parameters of the constructor of this database:
- database :
bob.db.verification.filelist.Database
- The database that provides the actual interface
- kwargs
- Keyword arguments directly passed to the
DatabaseBobZT
base class constructor
-
all_files
(groups=['dev'])[source]¶ Returns all File objects of the database for the current protocol. If the current protocol is ‘None’ (a string), None (NoneType) will be used instead
-
annotations
(file)¶ Returns the annotations for the given File object, if available.
-
arrange_by_client
(files)¶ Arranges the given list of files by client id. This function returns a list of lists of File’s.
-
client_id_from_model_id
(model_id, group='dev')[source]¶ Returns the client id for the given model id.
-
client_id_from_t_model_id
(t_model_id, group='dev')[source]¶ Returns the client id for the given T-model id.
-
enroll_files
(model_id, group='dev')¶ Returns the list of enrollment File objects for the given model id.
-
file_names
(files, directory, extension)¶ Returns the full path of the given File objects.
-
original_file_names
(files)¶ Returns the full path of the original data of the given File objects.
-
probe_file_sets
(model_id=None, group='dev')¶ Returns the list of probe File objects (for the given model id, if given).
-
probe_files
(model_id=None, group='dev')¶ Returns the list of probe File objects (for the given model id, if given).
-
sort
(files)¶ Returns a sorted version of the given list of File’s (or other structures that define an ‘id’ data member). The files will be sorted according to their id, and duplicate entries will be removed.
-
t_enroll_files
(model_id, group='dev')¶ Returns the list of enrollment File objects for the given T-Norm model id.
-
t_model_ids
(group='dev')[source]¶ Returns the T-Norm model ids for the given group and the current protocol.
-
test_files
(groups=['dev'])¶ Returns the test files (i.e., enrollment and probe files) for the given groups.
-
training_files
(step=None, arrange_by_client=False)¶ Returns all training File objects of the database for the current protocol.
-
uses_probe_file_sets
()[source]¶ Defines if, for the current protocol, the database uses several probe files to generate a score.
-
z_probe_file_sets
(group='dev')¶ Returns the list of Z-probe Fileset objects.
-
z_probe_files
(group='dev')¶ Returns the list of Z-probe File objects.
- database :
-
class
facereclib.databases.
DatabaseZT
(name, original_directory=None, original_extension=None, annotation_directory=None, annotation_extension='.pos', annotation_type=None, protocol='Default', **kwargs)[source]¶ Bases:
facereclib.databases.Database.Database
This class defines additional API functions that are required to compute ZT score normalization. During construction, please call the constructor of the base class ‘Database’ directly.
Parameters to the constructor of the Database:
- name
- A unique name for the database.
- original_directory
- The directory where the original data of the database are stored.
- original_extension
- The file extension of the original data.
- annotation_directory
- The directory where the image annotations of the database are stored, if any.
- annotation_directory
- The file extension of the annotation files.
- protocol
- The name of the protocol that defines the default experimental setup for this database.
- kwargs
- Ignored extra arguments.
-
all_files
(groups=None)¶ Returns all files of the database
-
annotations
(file)¶ Returns the annotations for the given File object, if available.
-
arrange_by_client
(files)¶ Arranges the given list of files by client id. This function returns a list of lists of File’s.
-
client_id_from_model_id
(model_id, group='dev')¶ Returns the client id for the given model id
-
client_id_from_t_model_id
(t_model_id, group='dev')[source]¶ Returns the client id for the given T-model id. In this base class implementation, we just use the
client_id_from_model_id()
function. Overload this function if you need another behavior.
-
enroll_files
(model_id, group='dev')¶ Returns a list of enrollment File objects for the given model id and the given group
-
file_names
(files, directory, extension)¶ Returns the full path of the given File objects.
-
model_ids
(group='dev')¶ Returns a list of model ids for the given group
-
original_file_names
(files)¶ Returns the full path of the original data of the given File objects.
-
probe_file_sets
(model_id=None, group='dev')¶ Returns a list of probe FileSet object in a specific format that should be compared with the model belonging to the given model id of the specified group
-
probe_files
(model_id=None, group='dev')¶ Returns a list of probe File object in a specific format that should be compared with the model belonging to the given model id of the specified group
-
sort
(files)¶ Returns a sorted version of the given list of File’s (or other structures that define an ‘id’ data member). The files will be sorted according to their id, and duplicate entries will be removed.
-
t_enroll_files
(model_id, group='dev')[source]¶ Returns a list of enrollment files for the given T-Norm model id and the given group
-
training_files
(step=None, arrange_by_client=False)¶ Returns all training File objects for the given step (might be ‘train_extractor’, ‘train_projector’, ‘train_enroller’ or None), and arranges them by client, if desired
-
uses_probe_file_sets
()¶ Defines if, for the current protocol, the database uses several probe files to generate a score. By default, False is returned. Overwrite the default if you need different behavior.