Python API

This is the Bob database entry for the Multi-PIE database.

class bob.db.multipie.Camera(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Multi-PIE cameras

id
files_multiview
name
class bob.db.multipie.Client(id, group, birthyear, gender, first_session, second_session, third_session, fourth_session)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Database clients, marked by an integer identifier and the group they belong to

group_choices = ('dev', 'eval', 'world')
gender_choices = ('male', 'female')
id
sgroup
birthyear
gender
first_session
second_session
third_session
fourth_session
class bob.db.multipie.Database(original_directory=None, original_extension='.png', annotation_directory=None, annotation_extension='.pos')[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.

groups(protocol=None)[source]

Returns the names of all registered groups

genders()[source]

Returns the list of genders

subworlds()[source]

Returns the list of subworlds

has_subworld(name)[source]

Tells if a certain subworld is available

subworld_names()[source]

Returns all registered subworld names

expressions()[source]

Returns the list of expressions

has_expression(name)[source]

Tells if a certain expression is available

expression_names()[source]

Returns all registered expression names

cameras()[source]

Returns the list of cameras

has_camera(name)[source]

Tells if a certain camera is available

camera_names()[source]

Returns all registered camera names

clients(protocol=None, groups=None, subworld=None, genders=None, birthyears=None)[source]

Returns a set of Clients for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

groups

The groups to which the clients belong (‘dev’, ‘eval’, ‘world’)

subworld

Specify a split of the world data (‘sub41’, ‘sub81’, ‘sub121’, ‘sub161’) In order to be considered, “world” should be in groups.

genders

The genders to which the clients belong (‘female’, ‘male’)

birthyears

The birth year of the clients (in the range [1900,2050])

Returns: A list containing all the Clients which have the given properties.

has_client_id(id)[source]

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

client(id)[source]

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

tclients(protocol=None, groups=None)[source]

Returns a set of T-Norm clients for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

groups

The groups to which the clients belong (‘dev’, ‘eval’).

Returns: A list containing all the client ids belonging to the given group.

zclients(protocol=None, groups=None)[source]

Returns a set of Z-Norm clients for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

groups

The groups to which the clients belong (‘dev’, ‘eval’).

Returns: A list containing all the client ids belonging to the given group.

models(protocol=None, groups=None)[source]

Returns a set of models for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

groups

The groups to which the subjects attached to the models belong (‘dev’, ‘eval’, ‘world’)

Returns: A list containing all the models belonging to the given group.

model_ids(protocol=None, groups=None)[source]

Returns a set of model ids for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

groups

The groups to which the subjects attached to the models belong (‘dev’, ‘eval’, ‘world’)

Returns: A list containing the ids all the models belonging to the given group.

tmodels(protocol=None, groups=None)[source]

Returns a set of T-Norm models for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

groups

The groups to which the models belong (‘dev’, ‘eval’).

Returns: A list containing all the T-Norm models belonging to the given group.

tmodel_ids(protocol=None, groups=None)[source]

Returns a set of T-Norm model ids for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

groups

The groups to which the models belong (‘dev’, ‘eval’).

Returns: A list containing all ids of the T-Norm models belonging to the given group.

get_client_id_from_model_id(model_id, **kwargs)[source]

Returns the client_id attached to the given model_id

Keyword Parameters:

model_id

The model_id to consider

Returns: The client_id attached to the given model_id

objects(protocol=None, purposes=None, model_ids=None, groups=None, classes=None, subworld=None, expressions=None, cameras=None, world_sampling=1, world_noflash=False, world_first=False, world_second=False, world_third=False, world_fourth=False, world_nshots=None, world_shots=None)[source]

Returns a set of Files for the specific query by the user.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

purposes

The purposes required to be retrieved (‘enroll’, ‘probe’, ‘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” group.

model_ids

Only retrieves the files for the provided list of model ids (claimed client id). If ‘None’ is given (this is the default), no filter over the model_ids is performed.

groups

One of the groups (‘dev’, ‘eval’, ‘world’) 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.

subworld

Specify a split of the world data (‘sub41’, ‘sub81’, ‘sub121’, ‘sub161’) In order to be considered, “world” should be in groups.

expressions

The (face) expressions to be retrieved (use expression_names() to get the list of expressions) 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. Notice that some protocols only contain images with ‘neutral’ expression.

cameras

The cameras to be retrieved (use camera_names() to get the list of cameras) r 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. The cameras keyword has no impact for some protocols (frontal images ones).

world_sampling

Samples the files from the world data set. Keeps only files such as:

File.client_id + File.shot_id % world_sampling == 0

This argument should be an integer between 1 (keep everything) and 19. It is not used if world_noflash is also set.

world_nshots

Only considers the n first shots from the world data set.

world_shots

Only considers the shots with the given ids.

world_noflash

Keeps the files from the world dataset recorded without flash (shot 0)

world_first

Only uses data from the first recorded session of each user of the world dataset.

world_second

Only uses data from the second recorded session of each user of the world dataset.

world_third

Only uses data from the third recorded session of each user of the world dataset.

world_fourth

Only uses data from the fourth recorded session of each user of the world dataset.

Returns: A set of Files with the given properties.

tobjects(protocol=None, model_ids=None, groups=None, expressions=None)[source]
Returns a set of filenames for enrolling T-norm models for score

normalization.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

model_ids

Only retrieves the files for the provided list of model ids (claimed client id). If ‘None’ is given (this is the default), no filter over the model_ids is performed.

groups

The groups to which the clients belong (‘dev’, ‘eval’).

expressions

The (face) expressions to be retrieved (use expression_names() to get the list of expressions) 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. Notice that some protocols only contain images with ‘neutral’ expression.

Returns: A list of Files with the given properties.

zobjects(protocol=None, model_ids=None, groups=None, expressions=None)[source]

Returns a set of filenames of impostors for Z-norm score normalization.

Keyword Parameters:

protocol

One of the Multi-PIE protocols (use protocol_names() to get the list of available ones)

model_ids

Only retrieves the files for the provided list of model ids (client id). If ‘None’ is given (this is the default), no filter over the model_ids is performed.

groups

The groups to which the clients belong (‘dev’, ‘eval’).

expressions

The (face) expressions to be retrieved (use expression_names() to get the list of expressions) 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. Notice that some protocols only contain images with ‘neutral’ expression.

Returns: A list of Files with the given properties.

annotations(file)[source]

Reads the annotations for the given file id from file and returns them in a dictionary. Depending on the view type of the file (i.e., the camera), different annotations might be returned.

If you have no copy of the annotations yet, you can download them under http://www.idiap.ch/resource/biometric, where you also can find more information about the annotations.

Keyword parameters:

file

The ID of the file for which the annotations should be read.

Return value

The annotations as a dictionary, e.g., {‘reye’:(re_y,re_x), ‘leye’:(le_y,le_x), …}

protocol_names()[source]

Returns all registered protocol names

protocols()[source]

Returns all registered protocols

has_protocol(name)[source]

Tells if a certain protocol is available

protocol(name)[source]

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

protocol_purposes()[source]

Returns all registered protocol purposes

purposes()[source]

Returns the list of allowed purposes

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.

z_probe_files(protocol, groups='dev', **kwargs)[source]

Returns the list of Z-Norm probe File objects to probe the model with the given model id of the given protocol for the given group that satisfy your query. For possible keyword arguments, please check the zobjects() function.

class bob.db.multipie.Expression(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Multi-PIE expressions

id
files
name
class bob.db.multipie.File(client_id, path, session_id, recording_id, img_type, expression_id)[source]

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

Generic file container

id
path
imagetype_choices = ('multiview', 'highres')
client
client_id
session_id
recording_id
img_type
expression_id
class bob.db.multipie.FileMultiview(file_id, shot_id, camera_id)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Additional file information for multiview-like files

file
id
shot_id
camera_id
class bob.db.multipie.Protocol(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Multi-PIE protocols

id
name
class bob.db.multipie.ProtocolPurpose(protocol_id, sgroup, purpose)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Multi-PIE protocol purposes

id
group_choices = ('dev', 'eval', 'world')
purpose_choices = ('train', 'enroll', 'probe')
protocol
files
protocol_id
sgroup
purpose
class bob.db.multipie.Subworld(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Database clients belonging to the world group are split in two disjoint subworlds, onethird and twothirds

id
clients
name
bob.db.multipie.get_config()[source]

Returns a string containing the configuration information.