OULU-NPU Database Access in Bob

This package provides an interface to the OULU-NPU - 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.oulunpu to find the dataset:

$ bob config set bob.db.oulunpu.directory /path/to/downloaded/dataset

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

@INPROCEEDINGS{OULU_NPU_2017,
         author = {Boulkenafet, Z. and Komulainen, J. and Li, Lei. and Feng, X. and Hadid, A.},
       keywords = {biometrics, face recognition, anti-spoofing, presentation attack, generalization, colour texture},
          month = May,
          title = {{OULU-NPU}: A mobile face presentation attack database with real-world variations},
        journal = {IEEE International Conference on Automatic Face and Gesture Recognition},
           year = {2017},
}

Package Documentation

bob.db.oulunpu.OULUNPU_FRAME_SHAPE = (3, 1920, 1080)

Shape of the video frames in the oulunpu database.

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

Returns a string containing the configuration information.

class bob.db.oulunpu.Database(original_directory=None, name='oulunpu', pad_file_class=None, original_extension='.avi', **kwargs)

Bases: bob.pad.base.database.FileListPadDatabase

The database interface for the OULU-NPU 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:

file : bob.pad.base.database.PadFile
The file for which annotations should be returned.

Returns:

annots : dict or None
The annotations for the file, if available.
frame_shape
frames(padfile)[source]
number_of_frames(padfile)[source]
objects(groups=None, protocol=None, purposes=None, model_ids=None, classes=None, **kwargs)[source]

Returns the requested samples.

class bob.db.oulunpu.File(attack_type, client_id, path, file_id=None)

Bases: bob.pad.face.database.VideoPadFile

The file objects of the OULU-NPU dataset.

annotations

Reads the annotations

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

Returns the size of each frame in this database.

Returns:The (#Channels, Height, Width) which is OULUNPU_FRAME_SHAPE.
Return type:(int, int, int)
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='.avi', 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

number_of_frames

Returns the number of frames in a video file.

Returns:The number of frames.
Return type:int