diff --git a/bob/bio/base/script/vanilla_biometrics.py b/bob/bio/base/script/vanilla_biometrics.py index 0d5ea0c0a9677b5029031ac8515fcad245392ba1..c64b610769ac54561914652323ef6ffb0b78f675 100644 --- a/bob/bio/base/script/vanilla_biometrics.py +++ b/bob/bio/base/script/vanilla_biometrics.py @@ -12,6 +12,10 @@ import click from bob.extension.scripts.click_helper import verbosity_option, ResourceOption, ConfigCommand +import logging +logger = logging.getLogger(__name__) + + EPILOG = """\b @@ -110,7 +114,6 @@ TODO: Work out this help default="results", help="Name of output directory", ) -@verbosity_option(cls=ResourceOption) def vanilla_biometrics( preprocessor, extractor, @@ -165,7 +168,7 @@ def vanilla_biometrics( """ - + # Always turn-on the checkpointing checkpointing = True @@ -224,3 +227,42 @@ def vanilla_biometrics( print(reference.subject, probe.subject, probe.path, reference.data) dask_client.shutdown() + + + +@click.command() +@click.argument("output-file") +@verbosity_option(cls=ResourceOption) +def vanilla_biometrics_template(output_file, **kwargs): + """ + Generate an template configuration file for the vanilla biometrics pipeline + """ + + import bob.io.base + + path = os.path.dirname(output_file) + logger.info(f"Writting template configuration file in {path}") + bob.io.base.create_directories_safe(path) + + template = ''' + +# Client dask. Look at https://gitlab.idiap.ch/bob/bob.pipelines/tree/master/bob/pipelines/config/distributed to find proper dask clients. +# You don't need to necessary instantiate a dask client yourself. You can simply pipe those config files + +dask_client = my_client + + +preprocessor = my_preprocessor + + +extractor = my_extractor + + +algorithm = my_algorithm + + +database = my_database + +''' + + open(output_file, "w").write(template) diff --git a/doc/experiments.rst b/doc/experiments.rst index 863d96a7d0c447234ca459d431531f644108ff6e..e82f891bb9ea747d6a07cc0f894e2fb15c7f328f 100644 --- a/doc/experiments.rst +++ b/doc/experiments.rst @@ -5,18 +5,35 @@ .. _bob.bio.base.experiments: -========================================== -Running Biometric Recognition Experiments -========================================== +====================================================================== +Running Biometric Recognition Experiments with the Vanilla Biometrics +====================================================================== Now, you are ready to run your first biometric recognition experiment. .. _running_part_1: -Running Experiments (part I) ----------------------------- -To run an experiment, we provide a generic script ``verify.py``. -As a default, ``verify.py`` accepts one or more *configuration files* that include the parametrization of the experiment to run. +Running Experiments. +-------------------- + +The previous section described the :ref:`bob.bio.base.struct_bio_rec_sys` using two sub-pipelines (three if you count the optional one) in a rough manner. +This section will describe in detail such sub-pipelines and its relation with biometric experiments. + +These sub-pipelines were built using `Dask delayed <https://docs.dask.org/en/latest/delayed.html>`_ ; please follow the Dask documentation for more information about it. +Another source of information is the `TAM tutorial given at Idiap <https://github.com/tiagofrepereira2012/tam->`_ + + +To run biometric experiments, we provide a generic CLI command called ``bob pipelines``. +Such CLI commands are entry-points to any kind of pipeline implemented under `bob.pipelines`. +This tutorial will focus on the pipeline called `vanilla-biometrics`. + +.. code-block:: sh + + bob pipelines vanilla-biometrics --help + + + +As a default, the ``vanilla-biometrics`` pipeline accepts one or more *configuration files* that include the parametrization of the experiment to run. A configuration file contains one ore more *variables* that define parts of the experiment. When several configuration files are specified, the variables of the latter will overwrite the ones of the former. For simplicity, here we discuss only a single configuration file. @@ -25,7 +42,7 @@ As a start, we have implemented a shortcut to generate an empty configuration fi .. code-block:: sh - $ verify.py --create-configuration-file experiment.py + $ bob pipelines vanilla-biometrics-template experiment.py .. note:: The generated ``experiment.py`` is a regular python file, so you can include any regular python code inside this file. @@ -36,6 +53,7 @@ But, no worries, most of them have proper default values. However, there are five variables, which are required and sufficient to define the complete biometric recognition experiment. These five variables are: +* ``dask_client``: The Dask client pointing the execution backend * ``database``: The database to run the experiments on * ``preprocessor``: The data preprocessor * ``extractor``: The feature extractor diff --git a/doc/img/bio_ident_sys.odg b/doc/img/bio_ident_sys.odg index ee288033c4ce97aaeff13a18b27af86953aa3ec5..cd5048e09dfc3623acdd23efd51ec65a01ae69f5 100644 Binary files a/doc/img/bio_ident_sys.odg and b/doc/img/bio_ident_sys.odg differ diff --git a/doc/img/bio_ident_sys.svg b/doc/img/bio_ident_sys.svg index f527c1f80b0eb954a1f1e930862a9e7ed7610abf..736c208edb687f2368601ff0cff8d9638235ecf3 100644 --- a/doc/img/bio_ident_sys.svg +++ b/doc/img/bio_ident_sys.svg @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.2" width="210mm" height="297mm" viewBox="0 0 21000 29700" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve"> +<svg version="1.2" width="210mm" height="148mm" viewBox="0 0 21000 14800" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve"> <defs class="ClipPathGroup"> <clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse"> - <rect x="0" y="0" width="21000" height="29700"/> + <rect x="0" y="0" width="21000" height="14800"/> </clipPath> <clipPath id="presentation_clip_path_shrink" clipPathUnits="userSpaceOnUse"> - <rect x="21" y="29" width="20958" height="29641"/> + <rect x="21" y="14" width="20958" height="14771"/> </clipPath> </defs> <defs> diff --git a/doc/img/bio_rec_sys.odg b/doc/img/bio_rec_sys.odg index c9bf08934ce1361b83a69bc702d5283bdbcae660..ab32dbd8eab6829347e2e3be3c64c1a2388be947 100644 Binary files a/doc/img/bio_rec_sys.odg and b/doc/img/bio_rec_sys.odg differ diff --git a/doc/img/bio_rec_sys.svg b/doc/img/bio_rec_sys.svg index b0bbb7e0208e82a16a04898f1ad9b7324efbe871..8d1f28aada98678c709983bcc7c458cc07c41352 100644 --- a/doc/img/bio_rec_sys.svg +++ b/doc/img/bio_rec_sys.svg @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.2" width="210mm" height="297mm" viewBox="0 0 21000 29700" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve"> +<svg version="1.2" width="210mm" height="148mm" viewBox="0 0 21000 14800" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve"> <defs class="ClipPathGroup"> <clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse"> - <rect x="0" y="0" width="21000" height="29700"/> + <rect x="0" y="0" width="21000" height="14800"/> </clipPath> <clipPath id="presentation_clip_path_shrink" clipPathUnits="userSpaceOnUse"> - <rect x="21" y="29" width="20958" height="29641"/> + <rect x="21" y="14" width="20958" height="14771"/> </clipPath> </defs> <defs> diff --git a/doc/img/bio_ver_sys.odg b/doc/img/bio_ver_sys.odg index 40f4eef5642babb105c35185c1a3bab5a514a509..e1fb6377acd1c7354f843168913582af5fe9e7ea 100644 Binary files a/doc/img/bio_ver_sys.odg and b/doc/img/bio_ver_sys.odg differ diff --git a/doc/img/bio_ver_sys.svg b/doc/img/bio_ver_sys.svg index b9b025237af4bca3abd1274a161ecb65c5438ad9..1c79e831ec70a1163bc1d6ca6854a813f28d4e6b 100644 --- a/doc/img/bio_ver_sys.svg +++ b/doc/img/bio_ver_sys.svg @@ -1,12 +1,12 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> -<svg version="1.2" width="210mm" height="297mm" viewBox="0 0 21000 29700" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve"> +<svg version="1.2" width="210mm" height="148mm" viewBox="0 0 21000 14800" preserveAspectRatio="xMidYMid" fill-rule="evenodd" stroke-width="28.222" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg" xmlns:ooo="http://xml.openoffice.org/svg/export" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:presentation="http://sun.com/xmlns/staroffice/presentation" xmlns:smil="http://www.w3.org/2001/SMIL20/" xmlns:anim="urn:oasis:names:tc:opendocument:xmlns:animation:1.0" xml:space="preserve"> <defs class="ClipPathGroup"> <clipPath id="presentation_clip_path" clipPathUnits="userSpaceOnUse"> - <rect x="0" y="0" width="21000" height="29700"/> + <rect x="0" y="0" width="21000" height="14800"/> </clipPath> <clipPath id="presentation_clip_path_shrink" clipPathUnits="userSpaceOnUse"> - <rect x="21" y="29" width="20958" height="29641"/> + <rect x="21" y="14" width="20958" height="14771"/> </clipPath> </defs> <defs> diff --git a/doc/index.rst b/doc/index.rst index 5cc6e7fd43b1363433ff7605e981226a6b5a1c69..21ac65cd9833679ba26d7f23fde20ad9e0f980b0 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -22,6 +22,19 @@ The ``bob.bio`` packages contain several implementations of each of the above st .. note:: The ``bob.bio`` packages are derived from the former `FaceRecLib <http://pypi.python.org/pypi/facereclib>`__, which is herewith outdated. + +bob.bio.base in one shot +======================== + + +If you are too lazy to go through the documentation, and just want to see what this is about, just run the command below: + +.. code-block:: sh + + bob pipelines vanilla-biometrics --help + + + Structure of the Biometric Recognition Framework ================================================ diff --git a/doc/struct_bio_rec_sys.rst b/doc/struct_bio_rec_sys.rst index 00d413217093e7bd89b7fc204d9c3ac23d0c2b85..e4574967a2af9731a72152c3ef4f810d21e3f761 100644 --- a/doc/struct_bio_rec_sys.rst +++ b/doc/struct_bio_rec_sys.rst @@ -196,3 +196,4 @@ The protocol also defines, which models should be compared to which probes. .. include:: links.rst + diff --git a/setup.py b/setup.py index 75b615ebc2f8a45291f013bdda637b8744a32310..ce5f07a172398d964ad40f0e8ff6afe64d9f3d71 100644 --- a/setup.py +++ b/setup.py @@ -142,6 +142,7 @@ setup( # run pipelines 'bob.pipelines.cli':[ 'vanilla-biometrics = bob.bio.base.script.vanilla_biometrics:vanilla_biometrics', + 'vanilla-biometrics-template = bob.bio.base.script.vanilla_biometrics:vanilla_biometrics_template' ],