SIW Database Access in Bob

This package provides an interface to the SIW - a mobile face presentation attack database with real-world variations database. The original data files need to be downloaded separately.After you have downloaded the dataset, you need to configure bob.db.siw to find the dataset:

$ bob config set /path/to/downloaded/dataset

Also, we provide our own annotations for this dataset because the ones provided with the dataset are not good. Download the annotations from here and extract them into a folder of your choice. Then, configure the database interface to find the extracted annotations using the following command:

$ bob config set bob.db.siw.annotation_dir /path/to/extracted/annotations

If you use this database, please cite the following publication:

  author = { Yaojie Liu* and Amin Jourabloo* and Xiaoming Liu },
  title = { Learning Deep Models for Face Anti-Spoofing: Binary or Auxiliary Supervision },
  booktitle = { In Proceeding of IEEE Computer Vision and Pattern Recognition },
  address = { Salt Lake City, UT },
  month = { June },
  year = { 2018 },

Package Documentation

bob.db.siw.SIW_FRAME_SHAPE = (3, 1080, 1920)

Shape of the video frames in the siw database.

class bob.db.siw.Database(original_directory=None, name='siw', pad_file_class=None, original_extension='.mov', annotation_directory=None, **kwargs)

Bases: bob.pad.base.database.FileListPadDatabase

The database interface for the SIW dataset.


Returns the annotations for the given File object, if available. You need to override this method in your high-level implementation. If your database does not have annotations, it should return None.



The file for which annotations should be returned.


annotsdict or None

The annotations for the file, if available.

objects(groups=None, protocol=None, purposes=None, model_ids=None, classes=None, **kwargs)[source]

Returns the requested samples.

class bob.db.siw.File(attack_type, client_id, path, file_id=None, original_directory=None, annotation_directory=None)

Bases: bob.pad.face.database.VideoPadFile

The file objects of the SIW dataset.

property annotations

Reads the annotations.

If the file object has an attribute of annotation_directory, it will read annotations from there instead of loading annotations that are shipped with the database.


The annotations as a dictionary, e.g.: {'0': {'reye':(re_y,re_x), 'leye':(le_y,le_x)}, ...}

Return type


property frame_shape

Returns the size of each frame in this database.


The (#Channels, Height, Width) which is SIW_FRAME_SHAPE.

Return type

(int, int, int)

property frames

Yields the frames of the biofile one by one.


numpy.array – A frame of the video. The size is (3, 1920, 1080).

load(directory=None, extension='.mov', frame_selector=< object>)[source]

Loads the video file and returns in a

  • directory (str, optional) – The directory to load the data from.

  • extension (str, optional) – The extension of the file to load.

  • frame_selector (, optional) – Which frames to select.


The loaded frames inside a frame container.

Return type

property number_of_frames

Returns the number of frames in a video file.


The number of frames.

Return type



Returns a string containing the configuration information.