From f5d0d2f8c7f37145d8ee9ab3ddd4701fea703b04 Mon Sep 17 00:00:00 2001 From: Olegs NIKISINS <onikisins@italix03.idiap.ch> Date: Thu, 22 Jun 2017 11:38:33 +0200 Subject: [PATCH] Added config file for Replay-Mobile + doc to resources + entry point --- bob/pad/face/config/database/replay_mobile.py | 48 +++++++++++++++++++ bob/pad/face/test/test_databases.py | 17 +++++++ doc/links.rst | 1 + doc/resources.rst | 12 ++++- setup.py | 1 + 5 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 bob/pad/face/config/database/replay_mobile.py diff --git a/bob/pad/face/config/database/replay_mobile.py b/bob/pad/face/config/database/replay_mobile.py new file mode 100644 index 00000000..000e93a1 --- /dev/null +++ b/bob/pad/face/config/database/replay_mobile.py @@ -0,0 +1,48 @@ +#!/usr/bin/env python + +"""`Replay-Mobile`_ is a database for face PAD experiments. + +The Replay-Mobile Database for face spoofing consists of 1030 video clips of photo and video attack attempts to 40 clients, +under different lighting conditions. +These videos were recorded with current devices from the market -- an iPad Mini2 (running iOS) and a LG-G4 smartphone (running Android). +This Database was produced at the Idiap Research Institute (Switzerland) within the framework +of collaboration with Galician Research and Development Center in Advanced Telecommunications - Gradiant (Spain). +The reference citation is [CBVM16]_. + +You can download the raw data of the `Replay-Mobile`_ database by following +the link. + +.. include:: links.rst +""" + +from bob.pad.face.database import ReplayMobilePadDatabase + + +# Directory where the data files are stored. +# This directory is given in the .bob_bio_databases.txt file located in your home directory +original_directory = "[YOUR_REPLAY_MOBILE_DIRECTORY]" +"""Value of ``~/.bob_bio_databases.txt`` for this database""" + +original_extension = ".mov" # extension of the data files + + +database = ReplayMobilePadDatabase( + protocol='grandtest', + original_directory=original_directory, + original_extension=original_extension, + training_depends_on_protocol=True, +) +"""The :py:class:`bob.pad.base.database.PadDatabase` derivative with Replay-Mobile +database settings. + +.. warning:: + + This class only provides a programmatic interface to load data in an orderly + manner, respecting usage protocols. It does **not** contain the raw + data files. You should procure those yourself. + +Notice that ``original_directory`` is set to ``[YOUR_REPLAY_MOBILE_DIRECTORY]``. +You must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this +value to the place where you actually installed the Replay-Mobile Database, as +explained in the section :ref:`bob.pad.face.baselines`. +""" \ No newline at end of file diff --git a/bob/pad/face/test/test_databases.py b/bob/pad/face/test/test_databases.py index 19f95692..141f018b 100644 --- a/bob/pad/face/test/test_databases.py +++ b/bob/pad/face/test/test_databases.py @@ -22,3 +22,20 @@ def test_replay(): except IOError as e: raise SkipTest( "The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) + + +@db_available('replay-mobile') +def test_replaymobile(): + replaymobile = bob.bio.base.load_resource('replay-mobile', 'database', preferred_package='bob.pad.face', package_prefix='bob.pad.') + try: + + assert len( replaymobile.objects(groups=['train', 'dev', 'eval']) )== 1030 + assert len( replaymobile.objects(groups=['train', 'dev']) ) == 728 + assert len( replaymobile.objects(groups=['train']) ) == 312 + assert len( replaymobile.objects(groups=['train', 'dev', 'eval'], protocol = 'grandtest') )== 1030 + assert len( replaymobile.objects(groups=['train', 'dev', 'eval'], protocol = 'grandtest', purposes='real') ) == 390 + assert len( replaymobile.objects(groups=['train', 'dev', 'eval'], protocol = 'grandtest', purposes='attack') ) == 640 + + except IOError as e: + raise SkipTest( + "The database could not be queried; probably the db.sql3 file is missing. Here is the error: '%s'" % e) \ No newline at end of file diff --git a/doc/links.rst b/doc/links.rst index 56b4ead8..32f077c3 100644 --- a/doc/links.rst +++ b/doc/links.rst @@ -10,5 +10,6 @@ .. _installation: https://www.idiap.ch/software/bob/install .. _bob.pad.base: https://pypi.python.org/pypi/bob.pad.base .. _replayattack: https://www.idiap.ch/dataset/replayattack +.. _replay-mobile: https://www.idiap.ch/dataset/replay-mobile .. _dependencies: https://gitlab.idiap.ch/bob/bob/wikis/Dependencies diff --git a/doc/resources.rst b/doc/resources.rst index f943abba..b761a780 100644 --- a/doc/resources.rst +++ b/doc/resources.rst @@ -24,12 +24,22 @@ These configuration files/resources contain entry points for the ``--database`` .. _bob.pad.face.resources.databases.replay: -Replay-attack Database +Replay-Attack Database ================================================================================ .. automodule:: bob.pad.face.config.database.replay :members: + +.. _bob.pad.face.resources.databases.replay_mobile: + +Replay-Mobile Database +================================================================================ + +.. automodule:: bob.pad.face.config.database.replay_mobile + :members: + + --------------------------------- diff --git a/setup.py b/setup.py index 13ada3f6..27af5799 100644 --- a/setup.py +++ b/setup.py @@ -96,6 +96,7 @@ setup( # registered databases: 'bob.pad.database': [ 'replay = bob.pad.face.config.database.replay:database', + 'replay-mobile = bob.pad.face.config.database.replay_mobile:database', ], # registered configurations: -- GitLab