Skip to content

Commit

Permalink
Merge pull request #4 from Gradiant/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
acostapazo authored May 18, 2019
2 parents 94d68a2 + d1b9b26 commit dcf34e6
Show file tree
Hide file tree
Showing 80 changed files with 330,976 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python
# Gradiant's Biometrics Team <[email protected]>
# Copyright (C) 2017 Gradiant, Vigo, Spain

import argparse
import os

from bob.gradiant.face.databases import AggregateDatabase, get_database_from_key, export_database_paths_from_file


def has_args(args):
is_active = False
for arg in vars(args):
is_active = is_active or getattr(args, arg)
return is_active


def write_dict_to_file(filename, d):
with open(filename, 'w') as f:
for k in d.keys():
f.write('{}\n'.format(k))


def main():
parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('--json-file',
type=str,
dest='json_file',
help='json file where the ROOT_PATH of each dataset is defined', required=True)

args = parser.parse_args()

if not has_args(args):
parser.print_help()
else:

base_output_path = 'gradgpad_protocols'
os.makedirs(base_output_path, exist_ok=True)

export_database_paths_from_file(args.json_file) # temporary
aggregate_database = get_database_from_key('aggregate-database') # returns an object of AggregateDatabase class

available_protocols = list(AggregateDatabase.get_available_protocols().keys())

for protocol in available_protocols:

protocol_output_path = '{}/{}'.format(base_output_path, protocol)
os.makedirs(protocol_output_path, exist_ok=True)

content = aggregate_database.get_ground_truth_list(protocol)
for subset, accesses in content.items():
filename = '{}/protocol_{}_{}.txt'.format(protocol_output_path, protocol, subset.lower())
write_dict_to_file(filename, accesses)


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion buildout.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ verbose = true
[sources]
bob.gradiant.pipelines = git https://github.com/Gradiant/bob.gradiant.pipelines.git rev=v1.1.0
bob.gradiant.core = git https://github.com/Gradiant/bob.gradiant.core.git rev=v1.2.0
bob.gradiant.face.databases = git https://github.com/Gradiant/bob.gradiant.face.databases.git rev=v2.0.0
bob.gradiant.face.databases = git https://github.com/Gradiant/bob.gradiant.face.databases.git rev=v2.0.1
bob.gradiant.pad.evaluator = git https://github.com/Gradiant/bob.gradiant.pad.evaluator.git rev=v1.2.0


Expand Down
2 changes: 1 addition & 1 deletion doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
else:
extensions.append('sphinx.ext.pngmath')

os.makedirs('examples')
os.makedirs('examples', exist_ok=True)
shutil.copy('../rr.sh', 'examples/rr.sh')
shutil.copy('../ci.sh', 'examples/ci.sh')
shutil.copy('../experiments/helpers/database_paths_vis1.json', 'examples/database_paths.json')
Expand Down
3 changes: 2 additions & 1 deletion doc/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ Doc
bin/sphinx-build -b html doc/ doc/html/
Continuous Integration
----------------------

In the following script (:code:`ci.sh`) you can check the different stages that are evaluated over the continuous integration pipeline:

Expand Down
36 changes: 34 additions & 2 deletions doc/grad_gpad.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,29 @@ GRAD-GPAD presents two main stages:
ii) evaluation, where a filtering step is applied, using the already extracted features and the common categorization of the datasets, to train and test over the selected features.


How to run my own experiment with our provided framework?
---------------------------------------------------------
In the time of the publication, the UVAD dataset haven't been parsed yet. Fortunately, now is available in the GRAD-GPAD framework.
From the following figures we may observe how is distributed the proposed Aggregate Dataset for the Grandtest protocol.

.. image:: img/grad-gpad-grandtest.png
:scale: 40 %
:alt: proposed_evaluation_framework
:align: center


.. image:: img/grad-gpad-grandtest-specific.png
:scale: 40 %
:alt: proposed_evaluation_framework
:align: center


Note:

The baseline for evaluation in the GRAD-GPAD without UVAD are the results reported in this paper,
whereas the baseline to evaluate with the new version of the GRAD-GPAD (with UVAD) are the results presented in the paper `Deep Anomaly Detection for Generalized Face Anti-Spoofing <https://arxiv.org/pdf/1904.08241.pdf>`_.


How to run my own experiment with GRAD-GPAD python framework?
-------------------------------------------------------------

Once we have available the publicly datasets, we have to create a json with the :code:`ROOT_PATH` of each dataset. Take the following file as an example:

Expand Down Expand Up @@ -174,3 +195,14 @@ Finally, to run the experiment, just type:
.. code-block:: sh
bin/algorithmic_constrained_evaluation.py -r experiment/mypad/configuration_mypad.py
Can the GRAD-GPAD framework be used in another platform/language/environment?
-----------------------------------------------------------------------------

The answer is yes, you can. We also provide several text list that define every of the protocols used.
This list are generated automatically from the framework. If you find any problem, please open an issue to try to solve it.

Find the protocols lists `here <https://github.com/Gradiant/bob.paper.icb2019.gradgpad/tree/master/gradgpad_protocols>`_.

Note that you should modify the :code:`DATABASE-NAME-PLACEHOLDER` in these files for each dataset.
Binary file added doc/img/grad-gpad-grandtest-specific.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/img/grad-gpad-grandtest.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit dcf34e6

Please sign in to comment.