Python API

The 3DMAD Database accessors for Bob

bob.db.maskattack.get_config()[source]

Returns a string containing the configuration information.

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

id
set
set_choices = ('world', 'dev', 'test')
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.

fileID_to_clientID(id)[source]

Returns the client ID of the given file ID

fileID_to_session(id)[source]

Returns the client ID of the given file ID

fileID_to_shot(id)[source]

Returns the client ID of the given file ID

has_client_id(id)[source]

Returns True if we have a client with a certain integer identifier

has_protocol(name)[source]

Tells if a certain protocol is available

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.

protocol(name)[source]

Returns the protocol object in the database given a certain name. Raises an error if that does not exist.

protocol_names()[source]

Returns all registered protocol names

protocol_purposes()[source]

Returns all registered protocol purposes

protocols()[source]

Returns all protocol objects.

purposes()[source]

Returns the list of allowed purposes

sets()[source]

Returns the names of all registered sets

class bob.db.maskattack.File(client_id, path, session, shot)[source]

Bases: sqlalchemy.ext.declarative.api.Base, bob.db.base.File

Generic file container

client
client_id
eyes(directory=None)[source]
facefile(directory='')[source]
id
is_real()[source]
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.
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.

path
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.
session
shot
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.

class bob.db.maskattack.Protocol(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Mask attack protocol

id
name