From 110d6c5eb2f95814d28d33d1ea63d4b9f9f45df4 Mon Sep 17 00:00:00 2001 From: Olegs NIKISINS <onikisins@italix03.idiap.ch> Date: Thu, 27 Jul 2017 11:11:39 +0200 Subject: [PATCH] Added config files for all databases, containing database, protocol, groups --- bob/pad/face/config/aggregated_db.py | 66 +++++++++++++++++++ .../database/{replay.py => replay_attack.py} | 0 bob/pad/face/config/msu_mfsd.py | 63 ++++++++++++++++++ bob/pad/face/config/replay_attack.py | 59 +++++++++++++++++ bob/pad/face/config/replay_mobile.py | 62 +++++++++++++++++ setup.py | 7 +- 6 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 bob/pad/face/config/aggregated_db.py rename bob/pad/face/config/database/{replay.py => replay_attack.py} (100%) create mode 100644 bob/pad/face/config/msu_mfsd.py create mode 100644 bob/pad/face/config/replay_attack.py create mode 100644 bob/pad/face/config/replay_mobile.py diff --git a/bob/pad/face/config/aggregated_db.py b/bob/pad/face/config/aggregated_db.py new file mode 100644 index 00000000..89b4b641 --- /dev/null +++ b/bob/pad/face/config/aggregated_db.py @@ -0,0 +1,66 @@ +#!/usr/bin/env python + +"""Aggregated Db is a database for face PAD experiments. +This database aggregates the data from 3 publicly available data-sets: +`REPLAYATTACK`_, `REPLAY-MOBILE`_ and `MSU MFSD`_. +You can download the data for the above databases by following the corresponding +links. + +The reference citation for the `REPLAYATTACK`_ is [CAM12]_. +The reference citation for the `REPLAY-MOBILE`_ is [CBVM16]_. +The reference citation for the `MSU MFSD`_ is [WHJ15]_. + +.. include:: links.rst +""" + +from bob.pad.face.database import AggregatedDbPadDatabase + +# 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_AGGREGATED_DB_DIRECTORIES]" +"""Value of ``~/.bob_bio_databases.txt`` for this database""" + +ORIGINAL_EXTENSION = ".mov" # extension of the data files + +database = AggregatedDbPadDatabase( + 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 Aggregated Db +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_AGGREGATED_DB_DIRECTORIES]``. +You must make sure to create ``${HOME}/.bob_bio_databases.txt`` file setting this +value to the places where you actually installed the Replay-Attack, Replay-Mobile +and MSU MFSD Databases. In particular, the paths pointing to these 3 databases +must be separated with a space. See the following note with an example of +``[YOUR_AGGREGATED_DB_DIRECTORIES]`` entry in the ``${HOME}/.bob_bio_databases.txt`` file. + +.. note:: + + [YOUR_AGGREGATED_DB_DIRECTORIES] = <PATH_TO_REPLAY_ATTACK> <PATH_TO_REPLAY_MOBILE> <PATH_TO_MSU_MFSD> +""" + +protocol = 'grandtest' +"""The default protocol to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--protocol`` on the +command-line of ``spoof.py`` or using the keyword ``protocol`` on a +configuration file that is loaded **after** this configuration resource. +""" + +groups = ["train", "dev", "eval"] +"""The default groups to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--groups`` on the +command-line of ``spoof.py`` or using the keyword ``groups`` on a +configuration file that is loaded **after** this configuration resource. +""" diff --git a/bob/pad/face/config/database/replay.py b/bob/pad/face/config/database/replay_attack.py similarity index 100% rename from bob/pad/face/config/database/replay.py rename to bob/pad/face/config/database/replay_attack.py diff --git a/bob/pad/face/config/msu_mfsd.py b/bob/pad/face/config/msu_mfsd.py new file mode 100644 index 00000000..133cc2ff --- /dev/null +++ b/bob/pad/face/config/msu_mfsd.py @@ -0,0 +1,63 @@ +#!/usr/bin/env python + +"""`MSU MFSD`_ is a database for face PAD experiments. + +Database created at MSU, for face-PAD experiments. The public version of the database contains +280 videos corresponding to 35 clients. The videos are grouped as 'genuine' and 'attack'. +The attack videos have been constructed from the genuine ones, +and consist of three kinds: print, iPad (video-replay), and iPhone (video-replay). +Face-locations are also provided for each frame of each video, but some (6 videos) face-locations are not reliable, +because the videos are not correctly oriented. +The reference citation is [WHJ15]_. + +You can download the raw data of the `MSU MFSD`_ database by following +the link. + +.. include:: links.rst +""" + +from bob.pad.face.database import MsuMfsdPadDatabase + +# 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_MSU_MFSD_DIRECTORY]" +"""Value of ``~/.bob_bio_databases.txt`` for this database""" + +ORIGINAL_EXTENSION = "none" # extension is not used to load the data in the HLDI of this database + +database = MsuMfsdPadDatabase( + 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 MSU MFSD +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_MSU_MFSD_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`. +""" + +protocol = 'grandtest' +"""The default protocol to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--protocol`` on the +command-line of ``spoof.py`` or using the keyword ``protocol`` on a +configuration file that is loaded **after** this configuration resource. +""" + +groups = ["train", "dev", "eval"] +"""The default groups to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--groups`` on the +command-line of ``spoof.py`` or using the keyword ``groups`` on a +configuration file that is loaded **after** this configuration resource. +""" diff --git a/bob/pad/face/config/replay_attack.py b/bob/pad/face/config/replay_attack.py new file mode 100644 index 00000000..3992d6fe --- /dev/null +++ b/bob/pad/face/config/replay_attack.py @@ -0,0 +1,59 @@ +#!/usr/bin/env python + +"""`Replayattack`_ is a database for face PAD experiments. + +The Replay-Attack Database for face spoofing consists of 1300 video clips of photo and video attack attempts to 50 clients, +under different lighting conditions. This Database was produced at the Idiap Research Institute, in Switzerland. +The reference citation is [CAM12]_. + +You can download the raw data of the `Replayattack`_ database by following +the link. + +.. include:: links.rst +""" + +from bob.pad.face.database import ReplayPadDatabase + +# 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_ATTACK_DIRECTORY]" +"""Value of ``~/.bob_bio_databases.txt`` for this database""" + +ORIGINAL_EXTENSION = ".mov" # extension of the data files + +database = ReplayPadDatabase( + 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 Replayattack +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_ATTACK_DIRECTORY]``. +You must make sure to create ``${HOME}/.bob_bio_databases.txt`` setting this +value to the place where you actually installed the Replayattack Database, as +explained in the section :ref:`bob.pad.face.baselines`. +""" + +protocol = 'grandtest' +"""The default protocol to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--protocol`` on the +command-line of ``spoof.py`` or using the keyword ``protocol`` on a +configuration file that is loaded **after** this configuration resource. +""" + +groups = ["train", "dev", "eval"] +"""The default groups to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--groups`` on the +command-line of ``spoof.py`` or using the keyword ``groups`` on a +configuration file that is loaded **after** this configuration resource. +""" diff --git a/bob/pad/face/config/replay_mobile.py b/bob/pad/face/config/replay_mobile.py new file mode 100644 index 00000000..453ca410 --- /dev/null +++ b/bob/pad/face/config/replay_mobile.py @@ -0,0 +1,62 @@ +#!/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`. +""" + +protocol = 'grandtest' +"""The default protocol to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--protocol`` on the +command-line of ``spoof.py`` or using the keyword ``protocol`` on a +configuration file that is loaded **after** this configuration resource. +""" + +groups = ["train", "dev", "eval"] +"""The default groups to use for reproducing the baselines. + +You may modify this at runtime by specifying the option ``--groups`` on the +command-line of ``spoof.py`` or using the keyword ``groups`` on a +configuration file that is loaded **after** this configuration resource. +""" diff --git a/setup.py b/setup.py index e0ac7ee6..0cd0a1cf 100644 --- a/setup.py +++ b/setup.py @@ -63,7 +63,7 @@ setup( # registered databases: 'bob.pad.database': [ - 'replay = bob.pad.face.config.database.replay:database', + 'replay-attack = bob.pad.face.config.database.replay_attack:database', 'replay-mobile = bob.pad.face.config.database.replay_mobile:database', 'msu-mfsd = bob.pad.face.config.database.msu_mfsd:database', 'aggregated-db = bob.pad.face.config.database.aggregated_db:database', @@ -71,6 +71,11 @@ setup( # registered configurations: 'bob.bio.config': [ + # databases + 'replay-attack = bob.pad.face.config.replay_attack', + 'replay-mobile = bob.pad.face.config.replay_mobile', + 'msu-mfsd = bob.pad.face.config.msu_mfsd', + 'aggregated-db = bob.pad.face.config.aggregated_db', # baselines: 'lbp-svm = bob.pad.face.config.lbp_svm', -- GitLab