Python API

Low level Bob API interface to voicePA speech presentation attack database.

class bob.db.voicepa.query.Database(original_directory=None, original_extension=None)

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.

asv_devices()[source]

Returns from the database the devices that were attacked (run ASV)

attack_datas()[source]

Returns attack supports available in the database

attack_devices()[source]

Returns attack devices available in the database

client(id)[source]

Returns the Client object in the database given a certain id. Raises an error if that does not exist.

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

Returns a list of Clients for the specific query by the user. If no parameters are specified - return all clients.

Keyword Parameters:

protocol
An voicePA protocol.
groups
The groups to which the subjects attached to the models belong (‘train’, ‘dev’, ‘eval’)
gender
The gender to consider (‘male’, ‘female’)

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

devices()[source]

Returns devices used in the database

environments()[source]

Returns from database the environments where attacks were recorded

file_speech()[source]

Returns attack sample types available in the database

genders()[source]

Returns the list of genders

groups()[source]

Returns the names of all registered groups

has_client_id(id)[source]

Returns True if we have a client with a certain integer identifier

has_protocol(name)[source]

Tells if a certain protocol is available

objects(protocol='grandtest', attack_data=('undefined', 'laptop', 'iphone3gs', 'samsungs3', 'ss', 'vc'), groups=('train', 'dev', 'eval'), cls=('real', ), recording_devices=('laptop', 'iphone3gs', 'samsungs3'), sessions=('sess1', 'sess2', 'sess3', 'sess4'), gender=('male', 'female'), attack_devices=('undefined', 'laptop', 'hqspeaker', 'iphone3gs', 'samsungs3', 'iphone6s'), asv_devices=('undefined', 'laptop', 'iphone3gs', 'samsungs3'), environments=('undefined', 'r106', 'r107', 'seboffice'), clients=None)[source]

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

Parameters:
  • protocol (str) – The protocol for the attack. one of the ones returned by protocols(). if you set this parameter to an empty string or the value none, we reset it to the default, “grandtest”.
  • groups (str) – One of the protocol subgroups of data as returned by groups() or a tuple with several of them. if you set this parameter to an empty string or the value none, we reset it to the default which is to get all.
  • cls (str) – Either attack, real, enroll, probe, or a combination of those (in a tuple). defines the class of data to be retrieved. If you set this parameter to an empty string or the value none, we reset it to the default, (real).
  • attack_data (str) – One of the valid attack types as returned by models.attack.attack_datas() or all, as a tuple. if you set this parameter to an empty string or the value none, we reset it to the default, which is to get all.
  • asv_devices (str) – One or more devices that are running automatic verification system, i.e., these are the devices that are being attacked.
  • attack_devices (str) – One or more devices that are used to play the presentation attack.
  • environments (str) – One or more locations (rooms) where the attacks were recorded.
  • recording_devices (str) – One of the recording_devices used to record the data (laptop, phone1, and phone2) or a combination of them (in a tuple), which is also the default.
  • clients (int) – If set, should be a single integer or a list of integers that define the client identifiers from which files should be retrieved. if omitted, set to none or an empty list, then data from all clients is retrieved.
Returns:

Corresponds to the selected objects

Return type:

list of File

protocol(name)[source]

Returns the protocol object in the database given a certain name. Raises an error if that does not exist.

protocol_names()[source]

Returns all registered protocol names

protocols()[source]

Returns all protocol objects.

sessions()[source]

Returns sessions used in the database