Commit 84dbb997 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI

Merge branch 'add-vuln' into 'master'

Add the vulnerability analysis commands

See merge request !243
parents 78f760ec 4051ebde
Pipeline #49280 failed with stages
in 6 minutes and 1 second
include LICENSE README.rst buildout.cfg develop.cfg version.txt requirements.txt test-requirements.txt
recursive-include doc *.py *.rst
recursive-include bob/bio/base/test/data *.* *-dev
recursive-include bob/bio/base/test/data *.* *-dev *-eval
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
"""The main entry for bob.vuln
"""
import click
import pkg_resources
from click_plugins import with_plugins
from bob.extension.scripts.click_helper import AliasedGroup
@with_plugins(pkg_resources.iter_entry_points('bob.vuln.cli'))
@click.group(cls=AliasedGroup)
def vulnerability():
"""Vulnerability analysis related commands."""
pass
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -7,7 +7,7 @@ import pkg_resources
import numpy
import nose
from bob.extension.scripts.click_helper import assert_click_runner_result
from ..script import commands, sort
from ..script import commands, sort, vuln_commands
from ..score import scores
def test_metrics():
......@@ -347,3 +347,146 @@ def test_sort():
path_scores = list(scores(path))
nose.tools.assert_list_equal(dev1_sorted, path_scores)
def test_det_vuln():
licit_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-dev')
licit_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-eval')
spoof_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-dev')
spoof_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-eval')
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(vuln_commands.det, ['-fnmr', '0.2',
'-o',
'DET.pdf',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
def test_fmr_iapmr_vuln():
licit_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-dev')
licit_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-eval')
spoof_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-dev')
spoof_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-eval')
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(vuln_commands.fmr_iapmr, [
'--output', 'FMRIAPMR.pdf', licit_dev, licit_test, spoof_dev,
spoof_test
])
assert_click_runner_result(result)
result = runner.invoke(vuln_commands.fmr_iapmr, [
'--output', 'FMRIAPMR.pdf', licit_dev, licit_test, spoof_dev,
spoof_test, '-G', '-L', '1e-7,1,0,1'
])
assert_click_runner_result(result)
def test_hist_vuln():
licit_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-dev')
licit_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-eval')
spoof_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-dev')
spoof_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-eval')
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(vuln_commands.hist,
['--criterion', 'eer', '--output',
'HISTO.pdf', '-b', '30', '-ts', 'A,B',
licit_dev, licit_test])
assert_click_runner_result(result)
with runner.isolated_filesystem():
result = runner.invoke(vuln_commands.hist,
['--criterion', 'eer', '--output',
'HISTO.pdf', '-b', '2,20,30', '-e',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
def test_epc_vuln():
licit_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-dev')
licit_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-eval')
spoof_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-dev')
spoof_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-eval')
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(vuln_commands.epc,
['--output', 'epc.pdf',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
result = runner.invoke(vuln_commands.epc,
['--output', 'epc.pdf', '-I',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
def test_epsc_vuln():
licit_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-dev')
licit_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-eval')
spoof_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-dev')
spoof_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-eval')
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(vuln_commands.epsc,
['--output', 'epsc.pdf',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
result = runner.invoke(vuln_commands.epsc,
['--output', 'epsc.pdf', '-I',
'-fp', '0.1,0.3',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
def test_epsc_3D_vuln():
licit_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-dev')
licit_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/licit/scores-eval')
spoof_dev = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-dev')
spoof_test = pkg_resources.resource_filename('bob.bio.base.test',
'data/spoof/scores-eval')
runner = CliRunner()
with runner.isolated_filesystem():
result = runner.invoke(vuln_commands.epsc,
['--output', 'epsc.pdf', '-D',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
result = runner.invoke(vuln_commands.epsc,
['--output', 'epsc.pdf', '-D',
'-I', '--no-wer',
licit_dev, licit_test,
spoof_dev, spoof_test])
assert_click_runner_result(result)
......@@ -116,6 +116,7 @@ setup(
# main entry for bob bio cli
'bob.cli': [
'bio = bob.bio.base.script.bio:bio',
'vulnerability = bob.bio.base.script.vulnerability:vulnerability'
],
# bob bio scripts
......@@ -149,7 +150,16 @@ setup(
'vanilla-biometrics-ztnorm = bob.bio.base.script.vanilla_biometrics_ztnorm:vanilla_biometrics_ztnorm'
],
# Vulnerability analysis commands
'bob.vuln.cli':[
'hist = bob.bio.base.script.vuln_commands:hist',
'det = bob.bio.base.script.vuln_commands:det',
'roc = bob.bio.base.script.vuln_commands:roc',
'epc = bob.bio.base.script.vuln_commands:epc',
'epsc = bob.bio.base.script.vuln_commands:epsc',
'gen = bob.bio.base.script.vuln_commands:gen',
'fmr_iapmr = bob.bio.base.script.vuln_commands:fmr_iapmr',
],
},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment