Python API¶
The 3DMAD Database accessors for Bob
-
class
bob.db.maskattack.
Database
(original_directory=None, original_extension=None)[source]¶ Bases:
bob.db.base.SQLiteDatabase
The dataset class opens and maintains a connection opened to the Database.
It provides many different ways to probe for the characteristics of the data and for the data itself inside the database.
-
clients
(protocol=None, sets=None)[source]¶ Returns a set of clients for the specific query by the user.
Keyword Parameters:
- protocol
The protocol to consider (‘verification’,)
- sets
The sets to which the clients belong (‘world’, ‘dev’, ‘test’)
Returns: A list containing all the clients which have the given properties.
-
protocol
(name)[source]¶ Returns the protocol object in the database given a certain name. Raises an error if that does not exist.
-
objects
(protocol=None, purposes=None, client_ids=None, sets=None, classes=None, groups=None)[source]¶ Returns a set of filenames for the specific query by the user.
Keyword Parameters:
protocol One of the 3DMAD protocols (‘verification’, ‘’).
purposes The purposes required to be retrieved (‘enrol’, ‘probeReal’, ‘probeMask’, ‘train’) or a tuple with several of them. If ‘None’ is given (this is the default), it is considered the same as a tuple with all possible values. This field is ignored for the data from the “world” set.
model_ids Only retrieves the files for the provided list of model ids (claimed client id). The model ids are string. If ‘None’ is given (this is the default), no filter over the model_ids is performed.
sets One of the sets (‘world’, ‘dev’, ‘test’) or a tuple with several of them. If ‘None’ is given (this is the default), it is considered the same as a tuple with all possible values.
classes The classes (types of accesses) to be retrieved (‘client’, ‘impostor’) or a tuple with several of them. If ‘None’ is given (this is the default), it is considered the same as a tuple with all possible values.
Returns: A list of files which have the given properties.
-
-
class
bob.db.maskattack.
Client
(client_id, dataset)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
Database clients, marked by an integer identifier and the set they belong to
-
set_choices
= ('world', 'dev', 'test')¶ Possible groups to which clients may belong to
-
id
¶ Key identifier for clients
-
set
¶ Set to which this client belongs to
-
-
class
bob.db.maskattack.
File
(client_id, path, session, shot)[source]¶ Bases:
sqlalchemy.ext.declarative.api.Base
,bob.db.base.File
Generic file container
-
id
¶ Key identifier for files
-
client
¶ A direct link to the client object that this file belongs to
-
client_id
¶ The client identifier to which this file is bound to
-
path
¶ The (unique) path to this file inside the database
-
session
¶ The session identifier in which the data for this file was taken
-
shot
¶ The shot identifier in which the data for this file was taken
-
videofile
(directory=None)[source]¶ Returns the path to the database video file for this object Keyword parameters: directory: An optional directory name that will be prefixed to the returned result.
Returns a string containing the video file path.
-
make_path
(directory=None, extension='.hdf5')[source]¶ Wraps the current path so that a complete path is formed
Keyword parameters:
- directory
An optional directory name that will be prefixed to the returned result.
- extension
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.
-
load
(directory=None, extension='.hdf5', isdepth=True, iseye=True)[source]¶ Loads the data at the specified location and using the given extension.
Keyword parameters:
- data
The data blob to be saved (normally a
numpy.ndarray
).- directory
[optional] If not empty or None, this directory is prefixed to the final file destination
- extension
[optional] The extension of the filename - this will control the type of output and the codec for saving the input blob.
-
save
(data, directory=None, extension='.hdf5')[source]¶ Saves the input data at the specified location and using the given extension.
Keyword parameters:
- data
The data blob to be saved (normally a
numpy.ndarray
).- directory
[optional] If not empty or None, this directory is prefixed to the final file destination
- extension
[optional] The extension of the filename - this will control the type of output and the codec for saving the input blob.
-