Python API

This is the Bob database entry for the GBU (Good, Bad and Ugly) database.

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

Returns a string containing the configuration information.

class bob.db.gbu.Annotation(file_id, eyes)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Annotations of the GBU database consists only of the left and right eye positions. There is exactly one annotation for each file.

file_id
id
le_x
le_y
re_x
re_y
class bob.db.gbu.Client(signature)[source]

Bases: sqlalchemy.ext.declarative.api.Base

The client of the GBU database consists of an integral ID as well as the ‘signature’ as read from the file lists.

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

annotations(file)[source]

Returns the annotations for the given File object as a dictionary {‘reye’:(y,x), ‘leye’:(y,x)}.

client_ids(groups=None, subworld=None, protocol=None)[source]

Returns a list of client ids for the specific query by the user.

Keyword Parameters:

groups
One or several groups to which the models belong (‘world’, ‘dev’).
subworld
One or several training sets (‘x1’, ‘x2’, ‘x4’, ‘x8’), only valid if group is ‘world’.
protocol
One or several of the GBU protocols (‘Good’, ‘Bad’, ‘Ugly’), only valid if group is ‘dev’.

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

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

Returns a list of clients for the specific query by the user.

Keyword Parameters:

groups
One or several groups to which the models belong (‘world’, ‘dev’).
subworld
One or several training sets (‘x1’, ‘x2’, ‘x4’, ‘x8’), only valid if group is ‘world’.
protocol
One or several of the GBU protocols (‘Good’, ‘Bad’, ‘Ugly’), only valid if group is ‘dev’.

Returns: A list containing all the 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, group='dev', protocol_type='gbu', **kwargs)[source]

Returns the client id attached to the given model id. Dependent on the protocol type and the group, it is expected that

  • model_id is a file id, when protocol type is ‘gbu’
  • model_id is a client id, when protocol type is ‘multi’ or group is ‘world’

Keyword Parameters:

model_id
The model id to consider
group
The group to which the model belong, might be ‘world’ or ‘dev’.
protocol_type
One protocol type from (‘gbu’, ‘multi’)

Returns: The client_id attached to the given model_id

groups(protocol=None)[source]

Returns a list of groups for the given protocol

Keyword Parameters:

protocol
One or several of the GBU protocols (‘Good’, ‘Bad’, ‘Ugly’), only valid if group is ‘dev’.

Returns: a list of groups

model_ids(groups=None, subworld=None, protocol=None, protocol_type='gbu')[source]

Returns a list of model ids for the specific query by the user. The returned list depends on the protocol_type:

  • ‘gbu’: A list containing file id’s (there is one model per file)
  • ‘multi’: A list containing client id’s (there is one model per client)

Note

for the ‘world’ group, model ids are ALWAYS client ids

Keyword Parameters:

groups
One or several groups to which the models belong (‘world’, ‘dev’).
subworld
One or several training sets (‘x1’, ‘x2’, ‘x4’, ‘x8’), only valid if group is ‘world’.
protocol
One or several of the GBU protocols (‘Good’, ‘Bad’, ‘Ugly’), only valid if group is ‘dev’.
protocol_type
One protocol type from (‘gbu’, ‘multi’)

Returns: A list containing all the model id’s belonging to the given group.

models(groups=None, subworld=None, protocol=None, protocol_type='gbu')[source]

Returns a list of models for the specific query by the user. The returned type of model depends on the protocol_type:

  • ‘gbu’: A list containing File objects (there is one model per file)
  • ‘multi’: A list containing Client objects (there is one model per client)

Keyword Parameters:

groups
One or several groups to which the models belong (‘world’, ‘dev’).
subworld
One or several training sets (‘x1’, ‘x2’, ‘x4’, ‘x8’), only valid if group is ‘world’.
protocol
One or several of the GBU protocols (‘Good’, ‘Bad’, ‘Ugly’), only valid if group is ‘dev’.
protocol_type
One protocol type from (‘gbu’, ‘multi’)

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

objects(groups=None, subworld=None, protocol=None, purposes=None, model_ids=None, protocol_type='gbu')[source]

Using the specified restrictions, this function returns a list of File objects.

Keyword Parameters:

groups
One or several groups to which the models belong (‘world’, ‘dev’).
subworld
One or several training sets (‘x1’, ‘x2’, ‘x4’, ‘x8’), only valid if group is ‘world’.
protocol
One or several of the GBU protocols (‘Good’, ‘Bad’, ‘Ugly’), only valid if group is ‘dev’.
purposes
One or several groups for which objects should be retrieved (‘enroll’, ‘probe’), only valid when the group is ‘dev’·
model_ids

If given (as a list of model id’s or a single one), only the objects belonging to the specified model id is returned. The content of the model id is dependent on the protocol type:

  • model id is a file id, when protocol type is ‘gbu’
  • model id is a client id, when protocol type is ‘multi’, or when group is ‘world’
protocol_type
One protocol type from (‘gbu’, ‘multi’), only required when model_ids are specified
class bob.db.gbu.File(presentation, signature, path)[source]

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

The file of the GBU database consists of an integral id as well as the ‘presentation’ as read from the file lists. Each file has one annotation and one associated client.

annotation
client
client_id
id
path
class bob.db.gbu.Protocol(name, purpose)[source]

Bases: sqlalchemy.ext.declarative.api.Base

The protocol class stores both the protocol name, as well as the purpose.

files
id
name
protocol_choices = ('Good', 'Bad', 'Ugly')
purpose
purpose_choices = ('enroll', 'probe')
class bob.db.gbu.Subworld(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

The subworld class defines different training set sizes. It is created from the ‘x1’, ‘x2’, ‘x4’ and ‘x8’ training lists from the GBU database.

files
id
name
subworld_choices = ('x1', 'x2', 'x4', 'x8')