IJB-C Database

This is the Bob database entry for the IJB-B database.

class bob.db.ijbc.Database(original_directory=None, check_valid=True)

Bases: bob.db.base.Database

The database 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, see Annotation for details.

check_parameter_for_validity(parameter, parameter_description, valid_parameters, default_parameter=None)
check_parameters_for_validity(parameters, parameter_description, valid_parameters, default_parameters=None)
client_ids(groups='dev', protocol=None)[source]

Returns a list of client ids (aka. subject_id) for the specific query by the user.

Keyword Parameters:

groups

Ignored; ‘dev’ is asssumed.

protocol

One of the protocols of the dataset; identical for all protocols starting with 1:

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

convert_names_to_highlevel(names, low_level_names, high_level_names)
convert_names_to_lowlevel(names, low_level_names, high_level_names)
file_names(files, directory, extension)
get_client_id_from_model_id(protocol, model_id)[source]

Returns the client_id attached to the given model_id

Keyword Parameters:

protocol

One of the protocols of the dataset; identical for all protocols starting with 1:

model_id

The model id (i.e., the template id of a gallery template) to consider

Returns: The client_id attached to the given model_id

get_model_ids_from_client_id(protocol, purpose, client_id)[source]

Returns the model ids (templates) for the given client_id

Keyword Parameters:

client_id

The client id

Returns: The list of model ids (template ids) of the client

groups(protocol=None)[source]
model_ids(groups='dev', protocol='1:1')[source]

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

Keyword Parameters:

groups

Ignored; 'dev' is assumed

protocol

One of the protocols of the dataset; identical for all protocols starting with 1:

Returns: A list containing all the model ids.

object_sets(groups='dev', protocol=None, purposes='probe', model_ids=None)[source]

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

Keyword Parameters:

groupsstr or [str]

Only the ‘dev’ group is accepted.

protocolstr

One of the available protocol names, see protocol_names().

purposes

Ignored; 'probe' is assumed.

model_idsint or [int] or None

If given, the probe templates belonging to the given model ids are returned.

objects(groups='dev', protocol=None, purposes=None, model_ids=None)[source]

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

Keyword Parameters:

groups

Ignored; 'dev' is assumed

protocolstr or None

One or more of the available protocol names, see protocol_names(). If not specified, all protocols will be assumed.

purposesstr or [str] or None

One or several purposes for which files should be retrieved (‘enroll’, ‘probe’). Note: this field is ignored for group ‘world’.

model_idsint or [int] or None

If given (as a list of model id’s or a single one), only the files belonging to the specified model id is returned. For ‘probe’ purposes, the probe images belonging to the given model ids are returned.

original_file_name(file, check_existence=True)[source]

Returns the original image file name with the correct file name extension. To be able to call this function, the original_directory must have been specified in the Database constructor.

Keyword parameters:

fileFile

The File object to get the original file name from.

check_existencebool

If set to True (the default), the existence of the original image file is checked, prior to returning the files name.

original_file_names(files)

Returns the full path of the original data of the given File objects.

Parameters

files (list of bob.db.base.File) – The list of file object to retrieve the original data file names for.

Returns

The paths extracted for the files, in the same order.

Return type

list of str

protocol_names()[source]

Returns all registered protocol names, including ['1:1', 'Covariates', '1:N-Mixed']

provides_file_set_for_protocol(protocol)[source]

Returns True for 1:1 and 1:N-… protocols, otherwise False

Keyword Parameters:

protocol

The protocol to evaluate.

sort(files)
templates(groups='dev', protocol=None)[source]

Returns all templates (enrollment and probe) for the given protocol

class bob.db.ijbc.File(subject_id, path, annotation=None)

Bases: bob.db.base.File

IJB-C File class

Different from its ascendant class, this one as input

load(directory=None, extension='.hdf5')[source]

Loads the data at the specified location and using the given extension. Override it if you need to load differently.

Parameters
  • directory (str, optional) – If not empty or None, this directory is prefixed to the final file destination

  • extension (str, optional) – If not empty or None, this extension is suffixed to the final file destination

Returns

The loaded data (normally numpy.ndarray).

Return type

object

static make_id(path, subject_id)[source]
make_path(directory=None, extension=None, add_client_id=True)[source]

Wraps the current path so that a complete path is formed. By default, the file name will be a unique file name, as there might be several File objects with the same path. To get the original file name, please set the add_client_id flag to False.

Keyword parameters:

directorystr or None

An optional directory name that will be prefixed to the returned result.

extensionstr or None

An optional extension that will be suffixed to the returned filename. The extension normally includes the leading . character as in .jpg or .hdf5.

add_client_idbool

By default, the client_id is added to generate a unique path. If set to false, the client_id will not be added.

Returns a string containing the newly generated file path, which by default is unique.

save(data, directory=None, extension='.hdf5', create_directories=True)[source]

Saves the input data at the specified location and using the given extension. Override it if you need to save differently.

Parameters
  • data (object) – The data blob to be saved (normally a numpy.ndarray).

  • directory (str, optional) – If not empty or None, this directory is prefixed to the final file destination

  • extension (str, optional) – The extension of the filename - this will control the type of output and the codec for saving the input blob.

  • create_directories (bool, optional) – Whether to create the required directories to save the data.

class bob.db.ijbc.Annotation(annots)[source]

Bases: object

Annotations for a File of the IJB-C dataset

class bob.db.ijbc.Template(template_id, subject_id, files=None)

Bases: object

A Template contains a list of File objects belonging to the same subject (there might be several templates per subject).

These are listed in the self.files field.

A Template can serve for training, model enrollment, or for probing.

Each template belongs specifically to a certain protocol, as the template_id in the original file lists might differ for different protocols.

The protocol purpose can be obtained using self.protocol_purpose after creation of the database.

Note that the template_id corresponds to the template_id of the file lists, while the id is only used as a unique key for querying the database.

For convenience, the template also contains a path, which is a concatenation of the File.media_id of the first file, and the self.template_id, making it unique (at least per protocol).

class bob.db.ijbc.Protocol

Bases: object

The list of protocols and their according files

enroll_template(protocol, model_id)[source]

Returns the enrollment template for the given model_id

get_templates(protocol, purpose=None)[source]

Returns all Template’s for the given protocol and purpose.

probe_templates(protocol, model_id)[source]

Returns the probe templates for the given model_id

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

Returns a string containing the configuration information.