BATL Database Interface

File Naming Conventions

The operator is asked to enter some information about the capture to the GUI. After the data capture, most of this information is encoded in the name of the file. All this information were also saved as an attribute in the HDF5 file.

Each saved file has the following name format:

<client_id>_<session_id>_<presenter_id>_<type_id>_<pai_id>.hdf5

  • client_id: This number presents the identity of what is presented to the system. For bonafide, it is the ID given to the subject upon arrival and for the attacks, it is a number given to a PAI in this protocol. Please note that if the identity of a subject is the same as the identity of an attack this number is the same for both cases. One example is the silicon masks. If a silicon mask is made from subject ‘x’ and subject ‘x’ also participated as bonafide in the data collection the ‘client_id’ for bonafide and silicon mask is the same.

  • session_id: The number of session mentioned before.

  • presenter_id: If a subject is presenting an attack to the system, this number is the subject’s ‘client_id’. If the attack is presented on a support, this number is ‘000’. If the capture is for bonafide this number is ‘000’ as well since there is no presenter in this case.

  • type_id: The type of attack based on groups mentioned before. For bonafide this number is ‘0’

  • pai_id: The unique number asscociated with each and every PAI. This number for bonafide with no medical glasses is ‘00’ and for bonafide with medical glasses is ‘01’. In our data capture we included retro glasses as bonafide as well and the ‘pai_id’ for it is ‘02’.

Here are some examples for more clarification:

  • 035_01_000_0_00.hdf5 : This is the bonafide file of client number 035 in session number 1 when they did not wear medical glasses.

  • 005_01_000_0_01.hdf5 : This is the bonafide file of client number 005 in session number 1 when they did wear medical glasses.

  • 530_03_001_2_18.hdf5 : This is a fake face attack where the identity 530 is presented to the camera by client number 001 in session 03.

  • 018_02_000_3_10.hdf5 : This is a photo attack where the identity 018 is presented to the camera using stand in session 02.

Package Documentation

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

Returns a string containing the configuration information.

class bob.db.batl.Client(id, is_presenter)[source]

Bases: sqlalchemy.ext.declarative.api.Base

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

get_raw_files()[source]
protocol_names()[source]

Returns all registered protocol names

protocols()[source]

Returns all registered protocols

has_protocol(name)[source]

Tells if a certain protocol is available

protocol(name)[source]

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

purposes()[source]

Returns the list of allowed purposes

groups()[source]

Returns the list of allowed groups

file_sessions()[source]

Returns the list of allowed session numbers

has_client_id(id)[source]

Returns True if in the database is a client with a certain integer identifier.

presenters(protocol)[source]

Returns a list of Client for the specific query by the user. Clients correspond to the database CLIENT entries

client(id)[source]

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

objects(protocol=None, groups=None, purposes=None, sessions=None)[source]

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

class bob.db.batl.Protocol(name)[source]

Bases: sqlalchemy.ext.declarative.api.Base

id
name
class bob.db.batl.ProtocolPurpose(group, purpose)[source]

Bases: sqlalchemy.ext.declarative.api.Base

BATL protocol purposes

id
protocol_id
PURPOSES = ('real', 'attack')
GROUPS = ('train', 'validation', 'test')
protocol
files
group
purpose
class bob.db.batl.VideoFile(path, client_id, session_id, presenter_id, type_id, pai_id)[source]

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

A class containing file related information of the BATL database.

path

A relative path to the file.

Type

str

file_id

A unique identifier of the file.

Type

int

client_id

A unique identifier specifying the client.

Type

int

session_id

Session identifier.

Type

int

presenter_id

A unique identifier specifying the client presenting the PAI.

Type

int

type_id

Identifier specifying the type of the attack.

Type

int

pai_id

Identifier encoding the type of the PAI.

Type

int

id
rppgfile_id
rppgfile
path
client_id
session_id
presenter_id
type_id
pai_id
load(directory=None, extension='.h5', reference_stream_type='color', modality='all', warp_to_reference=False, convert_to_rgb=False, crop=None, max_frames=None)[source]
Parameters
  • directory (str) – If not empty or None, this directory is prefixed to the final file destination. Default: None.

  • extension (str) – The extension of the file. Default for this database is ‘.h5’.

  • reference_stream_type (str) – Name of the reference stream (temporal and spatial alignment).

  • modality (str) – ‘all’ for all modalities (default), otherwise the name of the modality or a list of modalities to consider. Modalities can be [‘color’, ‘infrared’, ‘depth’, ‘thermal’, ‘infrared_high_def’, ‘thermal_high_def’]

  • warp_to_color (bool) – Warp the stream to the color stream. Default: False.

  • convert_to_rgb (bool) – Convert the data to RGB format. Default: False.

  • crop (bool) – A list with four parameters - startx = crop[0], starty = crop[1], width = crop[2], height = crop[3]. If given, the video will be cropped. Default: None.

  • max_frames (bool) – A maximum number of frames to load. If not given all frames will be loaded. Default: None.

Returns

dictionary with a dictionary per modality containing the timestamps, the video and the masks

Return type

py:class:dict

is_attack()[source]