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 bob.db.siw.directory /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:

@inproceedings{learning-deep-models-for-face-anti-spoofing-binary-or-auxiliary-supervision,
  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.

annotations(padfile)[source]

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.

Parameters:

filebob.pad.base.database.PadFile

The file for which annotations should be returned.

Returns:

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.

Returns

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

Return type

dict

property frame_shape

Returns the size of each frame in this database.

Returns

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.

Yields

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

load(directory=None, extension='.mov', frame_selector=<bob.bio.video.utils.FrameSelector.FrameSelector object>)[source]

Loads the video file and returns in a bob.bio.video.FrameContainer.

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

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

  • frame_selector (bob.bio.video.FrameSelector, optional) – Which frames to select.

Returns

The loaded frames inside a frame container.

Return type

bob.bio.video.FrameContainer

property number_of_frames

Returns the number of frames in a video file.

Returns

The number of frames.

Return type

int

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

Returns a string containing the configuration information.