CUHK Face Sketch FERET Database (CUFSF)

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

Returns a string containing the configuration information.

class bob.db.cuhk_cufsf.Annotation(file_id, le_x, le_y, re_x, re_y)[source]

Bases: sqlalchemy.ext.declarative.api.Base

  • Annotation.id
  • x
  • y
file_id
le_x
le_y
metadata = MetaData(bind=None)
re_x
re_y
class bob.db.cuhk_cufsf.Client(id, original_id)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Information about the clients (identities) of the CUHK-CUFS.

database_choices = ('feret',)
id
metadata = MetaData(bind=None)
original_database
original_id
class bob.db.cuhk_cufsf.Database(original_directory=None, original_extension=None, feret_directory=None)[source]

Bases: bob.db.base.SQLiteDatabase

Wrapper class for the CUHK-CUFSF database for Heterogeneous face recognition recognition (http://mmlab.ie.cuhk.edu.hk/archive/cufsf/).

Parameters

original_directory: str
The CUHK-CUFS path
original_extension: str
The extension of the image files (A list of possible extensions is acceptable)
feret_directory: str
The CUHK-CUFS path
all_files(**kwargs)

Returns the list of all File objects that satisfy your query.

For possible keyword arguments, please check the implemention’s objects() method.

annotations(file, annotation_type='eyes_center')[source]

This function returns the annotations for the given file id as a dictionary.

Parameters

file: bob.db.base.File
The File object you want to retrieve the annotations for,
Return
A dictionary of annotations, for face images usually something like {‘leye’:(le_y,le_x), ‘reye’:(re_y,re_x), …}, or None if there are no annotations for the given file ID (which is the case in this base class implementation).
assert_validity()

Raise a RuntimeError if the database back-end is not available.

check_parameter_for_validity(parameter, parameter_description, valid_parameters, default_parameter=None)
check_parameters_for_validity(parameters, parameter_description, valid_parameters, default_parameters=None)
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)
files(ids, preserve_order=True)

Returns a list of File objects with the given file ids

Parameters:
  • ids (list or tuple) – The ids of the object in the database table “file”. This object should be a python iterable (such as a tuple or list).
  • preserve_order (bool) – If True (the default) the order of elements is preserved, but the execution time increases.
Returns:

a list (that may be empty) of File objects.

Return type:

list

groups(protocol=None, **kwargs)[source]

This function returns the list of groups for this database.

is_valid()

Returns if a valid session has been opened for reading the database.

modalities
modality_separator
model_ids(protocol=None, groups=None)[source]
objects(groups=None, protocol=None, purposes=None, model_ids=None, modality=None, **kwargs)[source]

This function returns lists of File objects, which fulfill the given restrictions.

original_file_name(file, check_existence=True)[source]

This function returns the original file name for the given File object.

Parameters

file: File
The File objects for which the file name should be retrieved
check_existence: bool
Check if the original file exists? IGNORED: ALWAYS CHECK
Return
The original file name for the given File object
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
paths(ids, prefix=None, suffix=None, preserve_order=True)

Returns a full file paths considering particular file ids

Parameters:
  • ids (list or :obj`tuple`) – The ids of the object in the database table “file”. This object should be a python iterable (such as a tuple or list).
  • prefix (str, optional) – The bit of path to be prepended to the filename stem
  • suffix (str, optional) – The extension determines the suffix that will be appended to the filename stem.
  • preserve_order (bool) – If True (the default) the order of elements is preserved, but the execution time increases.
Returns:

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

Return type:

list

protocols()[source]
purposes()[source]
query(*args)

Creates a query to the database using the given arguments.

reverse(paths, preserve_order=True)

Reverses the lookup from certain paths, returns a list of bob.db.base.File’s

Parameters:
  • paths (list) – The filename stems (list of str) to query for. This object should be a python iterable (such as a tuple or list)
  • preserve_order (bool, optional) – If True (the default) the order of elements is preserved, but the execution time increases.
Returns:

A list (that may be empty).

Return type:

list

sort(files)
uniquify(file_list)

Sorts the given list of File objects and removes duplicates from it.

Parameters:file_list ([bob.db.base.File]) – A list of File objects to be handled. Also other objects can be handled, as long as they are sortable.
Returns:A sorted copy of the given file_list with the duplicates removed.
Return type:list
class bob.db.cuhk_cufsf.File(id, image_name, client_id, modality)[source]

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

Information about the files of the CUHK-CUFS database.

Each file includes * the client id

all_annotations
annotations(annotation_type='eyes_center')[source]
client
client_id
id
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

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.
  • 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.
Returns:

Returns a string containing the newly generated file path.

Return type:

str

metadata = MetaData(bind=None)
modality
modality_choices = ('photo', 'sketch')
path
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.cuhk_cufsf.Protocol_File_Association(protocol, group, purpose, file_id)[source]

Bases: sqlalchemy.ext.declarative.api.Base

Describe the protocols

file_id
group
metadata = MetaData(bind=None)
protocol
purpose