Python API

The AT&T “Database of Faces” is a small free facial image database to test face recognition and verification algorithms on. It is also known by its former name “The ORL Database of Faces”. You can download the AT&T database from: http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html

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

Returns a string containing the configuration information.

class bob.db.atnt.Client(client_id)[source]

Bases: object

The clients of this database contain ONLY client ids. Nothing special.

m_valid_client_ids = set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40])
class bob.db.atnt.Database(original_directory='/home/gitlab-runner/builds/0d638152/0/bob/bob.db.atnt/bob/db/atnt/data', original_extension='.pgm')[source]

Bases: bob.db.base.Database

Wrapper class for the AT&T (aka ORL) database of faces (http://www.cl.cam.ac.uk/research/dtg/attarchive/facedatabase.html). This class defines a simple protocol for training, enrollment and probe by splitting the few images of the database in a reasonable manner. Due to the small size of the database, there is only a ‘dev’ group, and I did not define an ‘eval’ group.

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

Returns the vector of ids of the clients used in a given group

Keyword Parameters:

groups
: str or [str]
One of the groups ‘world’, ‘dev’ or a tuple with both of them (which is the default).
protocol
Ignored.
clients(groups=None, protocol=None)[source]

Returns the vector of clients used in a given group

Keyword Parameters:

groups
: str or [str]
One of the groups ‘world’, ‘dev’ or a tuple with both of them (which is the default).
protocol
Ignored.
get_client_id_from_file_id(file_id, groups=None, protocol=None)[source]

Returns the client id from the given image id.

Keyword Parameters:

file_id
: int
The ID of the File object to get the client id for
groups
ignored.
protocol
ignored.
get_client_id_from_model_id(model_id, groups=None, protocol=None)[source]

Returns the client id from the given model id. Since client and model ids are identical, the model id is returned.

Keyword Parameters:

model_id
: int
The id of the model.
groups
ignored.
protocol
ignored.
groups(protocol=None)[source]

Returns the names of all registered groups

Keyword parameters:

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

Returns the vector of ids of the models (i.e., the client ids) used in a given group

Keyword Parameters:

groups
: str or [str]
One of the groups ‘world’, ‘dev’ or a tuple with both of them (which is the default).
protocol
Ignored.
models(groups=None, protocol=None)[source]

Returns the vector of models ( == clients ) used in a given group

Keyword Parameters:

groups
: str or [str]
One of the groups ‘world’, ‘dev’ or a tuple with both of them (which is the default).
protocol
Ignored.
objects(model_ids=None, groups=None, purposes=None, protocol=None)[source]

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

Keyword Parameters:

model_ids
: int or [int]
Limits the returned files relevant to this model id. This is expected to be used with groups=’dev’ only. When groups=’world’, this does not have any effect. Should be a list of integral numbers from [1,40]
groups
: str or [str]
One of the groups ‘world’ or ‘dev’ or a list with both of them (which is the default).
purposes
: str or [str]
One of the purposes ‘enroll’ or ‘probe’ or a list with both of them (which is the default). This field is ignored when the group ‘world’ is selected.
protocol
Ignored.

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

paths(file_ids, prefix=None, suffix=None, preserve_order=True)[source]

Returns a full file paths considering particular file ids, a given directory and an extension

Keyword Parameters:

file_ids
: int or [int]
The list of ids of the File objects in the database.
prefix
: str
The bit of path to be prepended to the filename stem
suffix
: str
The extension determines the suffix that will be appended to the filename stem.
preserve_order
: bool
Ignored since the order is always preserved.

Returns a list (that may be empty) of the fully constructed paths given the file ids.

reverse(paths, preserve_order=True)[source]

Reverses the lookup: from certain paths, return a list of File objects

Keyword Parameters:

paths
: [str]
The filename stems to query for. This object should be a python iterable (such as a tuple or list)
preserve_order
: bool
Ignored since the order is always preserved.

Returns a list (that may be empty).

class bob.db.atnt.File(client_id, client_file_id, install_path, default_ext)[source]

Bases: bob.db.base.File

Files of this database are composed from the client id and a file id.

Parameters:
  • client_id (int) – The unique client identity
  • client_file_id (int) – The unique file identity for this given client
  • install_path (str) – The installation path for the database
  • default_ext (str) – The default extension for the database (normally, should be .pgm)
load(directory=None, extension=None)[source]

Loads the data at the specified location and using the given extension.

Uses bob.io.base.load() to load the contents of the file named <directory>/<self.path>+<extension>. Returns whatever that function returns.

Parameters:
  • directory (str, Optional) – An optional directory name that will be prefixed to the returned result. If not set, use the database raw files installation directory as set on the database.
  • extension (str, Optional) – An optional extension that will be suffixed to the returned filename. The extension normally includes the leading . character as in .jpg or .hdf5. If not set, use the default for the database, which is .pgm.
Returns:

The return value of bob.io.base.load() given the input file type.

Return type:

object

m_valid_file_ids = set([1, 2, 3, 4, 5, 6, 7, 8, 9, 10])
make_path(directory=None, extension=None)[source]

Wraps the current path so that a complete path is formed

Parameters:
  • directory (str, Optional) – An optional directory name that will be prefixed to the returned result. If not set, use the database raw files installation directory as set on the database.
  • extension (str, Optional) – An optional extension that will be suffixed to the returned filename. The extension normally includes the leading . character as in .jpg or .hdf5. If not set, use the default for the database, which is .pgm.
Returns:

The newly generated file path.

Return type:

str