Python API

This is the Bob database entry for the Labeled Faces in the Wild (LFW) database.

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

Returns a string containing the configuration information.

class bob.db.lfw.Annotation(file_id, annotation_type, annotations)[source]

Bases: sqlalchemy.ext.declarative.api.Base

annotation_type
annotation_type_choices = ('funneled', 'idiap')
annotations
file_id
id
class bob.db.lfw.Client(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Information about the clients (identities) of the LFW database.

id
class bob.db.lfw.Database(original_directory=None, original_extension='.jpg', annotation_type=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.

annotation_types()[source]

Queries the database for the available types of annotations.

annotations(file, annotation_type=None)[source]

Returns the annotations for the given file id as a dictionary, e.g. {‘reye’:(y,x), ‘leye’:(y,x)}.

Keyword parameters:

file_id
The File object for which you want to retrieve the annotations
annotation_type
The type of annotations (‘idiap’, ‘funneled’). If not specified, and if not given in the constructor, all annotations are taken, which might to cause an assertion error.
clients(protocol=None, groups=None, subworld='sevenfolds', world_type='unrestricted')[source]

Returns a list of Client objects for the specific query by the user.

Keyword Parameters:

protocol
The protocol to consider; one of: (‘view1’, ‘fold1’, ..., ‘fold10’), or None
groups
The groups to which the clients belong; one or several of: (‘world’, ‘dev’, ‘eval’) Note: the ‘eval’ group does not exist for protocol ‘view1’.
subworld
The subset of the training data. Has to be specified if groups includes ‘world’ and protocol is one of ‘fold1’, ..., ‘fold10’. It might be exactly one of (‘onefolds’, ‘twofolds’, ..., ‘sevenfolds’). Ignored for group ‘dev’ and ‘eval’.
world_type
One of (‘restricted’, ‘unrestricted’). If ‘restricted’ (the default), only the clients that are used in one of the training pairs are returned. For ‘unrestricted’, all training people are returned. Ignored for group ‘dev’ and ‘eval’.

Returns: A list containing all Client objects which have the desired properties.

get_client_id_from_file_id(file_id, **kwargs)[source]

Returns the client_id (real client id) attached to the given file_id

Keyword Parameters:

file_id
The file_id to consider

Returns: The client_id attached to the given file_id

get_client_id_from_model_id(model_id, **kwargs)[source]

Returns the client_id (real client id) attached to the given model id

Keyword Parameters:

model_id
The model to consider
type
One of (‘restricted’, ‘unrestricted’). If the type ‘restricted’ is given, model_ids will be handled as file ids, if type is ‘unrestricted’, model ids will be client ids.

Returns: The client_id attached to the given model

groups(protocol=None)[source]

Returns the groups, which are available in the database.

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

Returns a list of model ids for the specific query by the user. For the ‘dev’ and ‘eval’ groups, the first element of each pair is extracted.

Keyword Parameters:

protocol
The protocol to consider; one of: (‘view1’, ‘fold1’, ..., ‘fold10’), or None
groups
The groups to which the clients belong; one or several of: (‘dev’, ‘eval’) The ‘eval’ group does not exist for protocol ‘view1’.

Returns: A list containing all model ids which have the desired properties.

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

Returns a list of File objects (there are multiple models per client) for the specific query by the user. For the ‘dev’ and ‘eval’ groups, the first element of each pair is extracted.

Keyword Parameters:

protocol
The protocol to consider; one of: (‘view1’, ‘fold1’, ..., ‘fold10’), or None
groups
The groups to which the clients belong; one or several of: (‘dev’, ‘eval’) The ‘eval’ group does not exist for protocol ‘view1’.

Returns: A list containing all File objects which have the desired properties.

objects(protocol=None, model_ids=None, groups=None, purposes=None, subworld='sevenfolds', world_type='unrestricted')[source]

Returns a list of File objects for the specific query by the user.

Keyword Parameters:

protocol
The protocol to consider (‘view1’, ‘fold1’, ..., ‘fold10’), or None
groups
The groups to which the objects belong (‘world’, ‘dev’, ‘eval’)
purposes
The purposes of the objects (‘enroll’, ‘probe’)
subworld
The subset of the training data. Has to be specified if groups includes ‘world’ and protocol is one of ‘fold1’, ..., ‘fold10’. It might be exactly one of (‘onefolds’, ‘twofolds’, ..., ‘sevenfolds’).
world_type
One of (‘restricted’, ‘unrestricted’). If ‘restricted’, only the files that are used in one of the training pairs are used. For ‘unrestricted’, all files of the training people are returned.
model_ids
Only retrieves the objects for the provided list of model ids. If ‘None’ is given (this is the default), no filter over the model_ids is performed. Note that the combination of ‘world’ group and ‘model_ids’ should be avoided.

Returns: A list of File objects considering all the filtering criteria.

pairs(protocol=None, groups=None, classes=None, subworld='sevenfolds')[source]

Queries a list of Pair’s of files.

Keyword Parameters:

protocol
The protocol to consider (‘view1’, ‘fold1’, ..., ‘fold10’)
groups
The groups to which the objects belong (‘world’, ‘dev’, ‘eval’)
classes
The classes to which the pairs belong (‘matched’, ‘unmatched’), or (‘client’, ‘impostor’)
subworld
The subset of the training data. Has to be specified if groups includes ‘world’ and protocol is one of ‘fold1’, ..., ‘fold10’. It might be exactly one of (‘onefolds’, ‘twofolds’, ..., ‘sevenfolds’).

Returns: A list of Pair’s considering all the filtering criteria.

protocol_names()[source]

Returns the names of the valid protocols.

subworld_names(protocol=None)[source]

Returns all valid sub-worlds for the fold.. protocols; for view1 an empty list is returned.

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.

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.

world_types()[source]

Returns the valid types of worlds: (‘restricted’, ‘unrestricted’).

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.

class bob.db.lfw.File(client_id, shot_id)[source]

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

Information about the files of the LFW database.

annotations
client
client_id
id
name
path
shot_id
class bob.db.lfw.Pair(protocol, enroll_file_id, probe_file_id, is_match)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Information of the pairs (as given in the pairs.txt files) of the LFW database.

enroll_file
enroll_file_id
id
is_match
probe_file
probe_file_id
protocol
class bob.db.lfw.People(protocol, file_id)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Information about the people (as given in the people.txt file) of the LFW database.

file_id
id
protocol