Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
bob.pad.base
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bob
bob.pad.base
Commits
45fb416d
Commit
45fb416d
authored
6 years ago
by
Theophile GENTILHOMME
Browse files
Options
Downloads
Patches
Plain Diff
Several fixed parameters can be passed to epsc
parent
32c8038c
No related branches found
No related tags found
1 merge request
!48
Various fix
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
bob/pad/base/script/vuln_commands.py
+7
-7
7 additions, 7 deletions
bob/pad/base/script/vuln_commands.py
bob/pad/base/script/vuln_figure.py
+62
-66
62 additions, 66 deletions
bob/pad/base/script/vuln_figure.py
with
69 additions
and
73 deletions
bob/pad/base/script/vuln_commands.py
+
7
−
7
View file @
45fb416d
...
@@ -229,7 +229,7 @@ def epc(ctx, scores, **kwargs):
...
@@ -229,7 +229,7 @@ def epc(ctx, scores, **kwargs):
@click.command
()
@click.command
()
@common_options.scores_argument
(
min_arg
=
2
,
force_eval
=
True
,
nargs
=-
1
)
@common_options.scores_argument
(
min_arg
=
2
,
force_eval
=
True
,
nargs
=-
1
)
@common_options.output_plot_file_option
(
default_out
=
'
vuln_epsc.pdf
'
)
@common_options.output_plot_file_option
(
default_out
=
'
vuln_epsc.pdf
'
)
@common_options.
legend
s_option
()
@common_options.
title
s_option
()
@common_options.no_legend_option
()
@common_options.no_legend_option
()
@common_options.legend_loc_option
()
@common_options.legend_loc_option
()
@common_options.const_layout_option
()
@common_options.const_layout_option
()
...
@@ -252,14 +252,13 @@ def epc(ctx, scores, **kwargs):
...
@@ -252,14 +252,13 @@ def epc(ctx, scores, **kwargs):
@click.option
(
'
-vp
'
,
'
--var-param
'
,
default
=
"
omega
"
,
show_default
=
True
,
@click.option
(
'
-vp
'
,
'
--var-param
'
,
default
=
"
omega
"
,
show_default
=
True
,
help
=
'
Name of the varying parameter
'
,
help
=
'
Name of the varying parameter
'
,
type
=
click
.
Choice
((
'
omega
'
,
'
beta
'
)))
type
=
click
.
Choice
((
'
omega
'
,
'
beta
'
)))
@click.option
(
'
-fp
'
,
'
--fixed-param
'
,
default
=
0.5
,
show_default
=
True
,
@list_float_option
(
name
=
'
fixed-params
'
,
short_name
=
'
fp
'
,
dflt
=
'
0.5
'
,
help
=
'
Value of the fixed parameter
'
,
desc
=
'
Values of the fixed parameter, separated by commas
'
)
type
=
click
.
FLOAT
)
@click.option
(
'
-s
'
,
'
--sampling
'
,
default
=
5
,
show_default
=
True
,
@click.option
(
'
-s
'
,
'
--sampling
'
,
default
=
5
,
show_default
=
True
,
help
=
'
Sampling of the EPSC 3D surface
'
,
type
=
click
.
INT
)
help
=
'
Sampling of the EPSC 3D surface
'
,
type
=
click
.
INT
)
@verbosity_option
()
@verbosity_option
()
@click.pass_context
@click.pass_context
def
epsc
(
ctx
,
scores
,
criteria
,
var_param
,
fixed_param
,
three_d
,
sampling
,
def
epsc
(
ctx
,
scores
,
criteria
,
var_param
,
three_d
,
sampling
,
**
kwargs
):
**
kwargs
):
"""
Plot EPSC (expected performance spoofing curve):
"""
Plot EPSC (expected performance spoofing curve):
...
@@ -283,18 +282,19 @@ def epsc(ctx, scores, criteria, var_param, fixed_param, three_d, sampling,
...
@@ -283,18 +282,19 @@ def epsc(ctx, scores, criteria, var_param, fixed_param, three_d, sampling,
$ bob vuln epsc -v -D {licit,spoof}/scores-{dev,eval}
$ bob vuln epsc -v -D {licit,spoof}/scores-{dev,eval}
"""
"""
fixed_params
=
ctx
.
meta
.
get
(
'
fixed_params
'
,
[
0.5
])
if
three_d
:
if
three_d
:
if
(
ctx
.
meta
[
'
wer
'
]
and
ctx
.
meta
[
'
iapmr
'
]):
if
(
ctx
.
meta
[
'
wer
'
]
and
ctx
.
meta
[
'
iapmr
'
]):
raise
click
.
BadParameter
(
'
Cannot plot both WER and IAPMR in 3D
'
)
raise
click
.
BadParameter
(
'
Cannot plot both WER and IAPMR in 3D
'
)
ctx
.
meta
[
'
sampling
'
]
=
sampling
ctx
.
meta
[
'
sampling
'
]
=
sampling
process
=
figure
.
Epsc3D
(
process
=
figure
.
Epsc3D
(
ctx
,
scores
,
True
,
load
.
split
,
ctx
,
scores
,
True
,
load
.
split
,
criteria
,
var_param
,
fixed_param
criteria
,
var_param
,
fixed_param
s
)
)
else
:
else
:
process
=
figure
.
Epsc
(
process
=
figure
.
Epsc
(
ctx
,
scores
,
True
,
load
.
split
,
ctx
,
scores
,
True
,
load
.
split
,
criteria
,
var_param
,
fixed_param
criteria
,
var_param
,
fixed_param
s
)
)
process
.
run
()
process
.
run
()
...
...
This diff is collapsed.
Click to expand it.
bob/pad/base/script/vuln_figure.py
+
62
−
66
View file @
45fb416d
...
@@ -209,19 +209,19 @@ class Epsc(VulnPlot):
...
@@ -209,19 +209,19 @@ class Epsc(VulnPlot):
'''
Handles the plotting of EPSC
'''
'''
Handles the plotting of EPSC
'''
def
__init__
(
self
,
ctx
,
scores
,
evaluation
,
func_load
,
def
__init__
(
self
,
ctx
,
scores
,
evaluation
,
func_load
,
criteria
,
var_param
,
fixed_param
):
criteria
,
var_param
,
fixed_param
s
):
super
(
Epsc
,
self
).
__init__
(
ctx
,
scores
,
evaluation
,
func_load
)
super
(
Epsc
,
self
).
__init__
(
ctx
,
scores
,
evaluation
,
func_load
)
self
.
_iapmr
=
False
if
'
iapmr
'
not
in
self
.
_ctx
.
meta
else
\
self
.
_iapmr
=
False
if
'
iapmr
'
not
in
self
.
_ctx
.
meta
else
\
self
.
_ctx
.
meta
[
'
iapmr
'
]
self
.
_ctx
.
meta
[
'
iapmr
'
]
self
.
_wer
=
True
if
'
wer
'
not
in
self
.
_ctx
.
meta
else
\
self
.
_wer
=
True
if
'
wer
'
not
in
self
.
_ctx
.
meta
else
\
self
.
_ctx
.
meta
[
'
wer
'
]
self
.
_ctx
.
meta
[
'
wer
'
]
self
.
_criteria
=
'
eer
'
if
criteria
is
None
else
criteria
self
.
_criteria
=
criteria
or
'
eer
'
self
.
_var_param
=
"
omega
"
if
var_param
is
None
else
var_param
self
.
_var_param
=
var_param
or
"
omega
"
self
.
_fixed_param
=
0.5
if
fixed_param
is
None
else
fixed_param
self
.
_fixed_params
=
fixed_params
or
[
0.5
]
self
.
_titles
=
ctx
.
meta
.
get
(
'
titles
'
,
[])
self
.
_eval
=
True
# always eval data with EPC
self
.
_eval
=
True
# always eval data with EPC
self
.
_split
=
False
self
.
_split
=
False
self
.
_nb_figs
=
1
self
.
_nb_figs
=
1
self
.
_title
=
ctx
.
meta
.
get
(
'
title
'
)
self
.
_sampling
=
ctx
.
meta
.
get
(
'
sampling
'
,
5
)
self
.
_sampling
=
ctx
.
meta
.
get
(
'
sampling
'
,
5
)
if
self
.
_min_arg
!=
4
:
if
self
.
_min_arg
!=
4
:
...
@@ -238,59 +238,55 @@ class Epsc(VulnPlot):
...
@@ -238,59 +238,55 @@ class Epsc(VulnPlot):
spoof_dev_pos
=
input_scores
[
2
][
1
]
spoof_dev_pos
=
input_scores
[
2
][
1
]
spoof_eval_neg
=
input_scores
[
3
][
0
]
spoof_eval_neg
=
input_scores
[
3
][
0
]
spoof_eval_pos
=
input_scores
[
3
][
1
]
spoof_eval_pos
=
input_scores
[
3
][
1
]
title
=
self
.
_legends
[
idx
]
if
self
.
_legends
is
not
None
else
None
mpl
.
gcf
().
clear
()
mpl
.
gcf
().
clear
()
points
=
10
points
=
10
for
pi
,
fp
in
enumerate
(
self
.
_fixed_params
):
if
self
.
_var_param
==
'
omega
'
:
omega
,
beta
,
thrs
=
error_utils
.
epsc_thresholds
(
licit_dev_neg
,
licit_dev_pos
,
spoof_dev_neg
,
spoof_dev_pos
,
points
=
points
,
criteria
=
self
.
_criteria
,
beta
=
self
.
_fixed_param
)
else
:
omega
,
beta
,
thrs
=
error_utils
.
epsc_thresholds
(
licit_dev_neg
,
licit_dev_pos
,
spoof_dev_neg
,
spoof_dev_pos
,
points
=
points
,
criteria
=
self
.
_criteria
,
omega
=
self
.
_fixed_param
)
errors
=
error_utils
.
all_error_rates
(
licit_eval_neg
,
licit_eval_pos
,
spoof_eval_neg
,
spoof_eval_pos
,
thrs
,
omega
,
beta
)
# error rates are returned in a list in the
# following order: frr, far, IAPMR, far_w, wer_w
ax1
=
mpl
.
subplot
(
111
)
# EPC like curves for FVAS fused scores for weighted error rates
# between the negatives (impostors and Presentation attacks)
if
self
.
_wer
:
if
self
.
_var_param
==
'
omega
'
:
if
self
.
_var_param
==
'
omega
'
:
mpl
.
plot
(
omega
,
beta
,
thrs
=
error_utils
.
epsc_thresholds
(
omega
,
licit_dev_neg
,
100.
*
errors
[
4
].
flatten
(),
licit_dev_pos
,
color
=
'
C0
'
,
spoof_dev_neg
,
linestyle
=
'
-
'
,
spoof_dev_pos
,
label
=
r
"
WER$_{\omega,\beta}$
"
)
points
=
points
,
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\omega$
"
)
criteria
=
self
.
_criteria
,
beta
=
fp
)
else
:
else
:
mpl
.
plot
(
omega
,
beta
,
thrs
=
error_utils
.
epsc_thresholds
(
beta
,
licit_dev_neg
,
100.
*
errors
[
4
].
flatten
(),
licit_dev_pos
,
color
=
'
C0
'
,
spoof_dev_neg
,
linestyle
=
'
-
'
,
spoof_dev_pos
,
label
=
r
"
WER$_{\omega,\beta}$
"
)
points
=
points
,
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\beta$
"
)
criteria
=
self
.
_criteria
,
mpl
.
ylabel
(
self
.
_y_label
or
r
"
WER$_{\omega,\beta}$ (%)
"
)
omega
=
fp
)
errors
=
error_utils
.
all_error_rates
(
licit_eval_neg
,
licit_eval_pos
,
spoof_eval_neg
,
spoof_eval_pos
,
thrs
,
omega
,
beta
)
# error rates are returned in a list in the
# following order: frr, far, IAPMR, far_w, wer_w
# between the negatives (impostors and Presentation attacks)
if
self
.
_wer
:
if
self
.
_var_param
==
'
omega
'
:
mpl
.
plot
(
omega
,
100.
*
errors
[
4
].
flatten
(),
color
=
self
.
_colors
[
pi
],
linestyle
=
'
-
'
,
label
=
r
"
WER$_{\omega,\beta}$
"
)
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\omega$
"
)
else
:
mpl
.
plot
(
beta
,
100.
*
errors
[
4
].
flatten
(),
color
=
self
.
_colors
[
pi
],
linestyle
=
'
-
'
,
label
=
r
"
WER$_{\omega,\beta}$
"
)
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\beta$
"
)
mpl
.
ylabel
(
self
.
_y_label
or
r
"
WER$_{\omega,\beta}$ (%)
"
)
if
self
.
_iapmr
:
if
self
.
_iapmr
:
axis
=
mpl
.
gca
()
axis
=
mpl
.
gca
()
...
@@ -302,7 +298,7 @@ class Epsc(VulnPlot):
...
@@ -302,7 +298,7 @@ class Epsc(VulnPlot):
omega
,
omega
,
100.
*
errors
[
2
].
flatten
(),
100.
*
errors
[
2
].
flatten
(),
color
=
'
C3
'
,
color
=
'
C3
'
,
linestyle
=
'
-
'
,
linestyle
=
'
-
-
'
,
label
=
'
IAPMR
'
)
label
=
'
IAPMR
'
)
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\omega$
"
)
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\omega$
"
)
else
:
else
:
...
@@ -310,7 +306,7 @@ class Epsc(VulnPlot):
...
@@ -310,7 +306,7 @@ class Epsc(VulnPlot):
beta
,
beta
,
100.
*
errors
[
2
].
flatten
(),
100.
*
errors
[
2
].
flatten
(),
color
=
'
C3
'
,
color
=
'
C3
'
,
linestyle
=
'
-
'
,
linestyle
=
'
-
-
'
,
label
=
'
IAPMR
'
)
label
=
'
IAPMR
'
)
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\beta$
"
)
mpl
.
xlabel
(
self
.
_x_label
or
r
"
Weight $\beta$
"
)
mpl
.
ylabel
(
self
.
_y_label
or
r
"
IAPMR (%)
"
)
mpl
.
ylabel
(
self
.
_y_label
or
r
"
IAPMR (%)
"
)
...
@@ -320,19 +316,19 @@ class Epsc(VulnPlot):
...
@@ -320,19 +316,19 @@ class Epsc(VulnPlot):
axis
.
yaxis
.
label
.
set_color
(
'
red
'
)
axis
.
yaxis
.
label
.
set_color
(
'
red
'
)
axis
.
spines
[
'
right
'
].
set_color
(
'
red
'
)
axis
.
spines
[
'
right
'
].
set_color
(
'
red
'
)
if
self
.
_var_param
==
'
omega
'
:
str_list
=
'
,
'
.
join
([
str
(
i
)
for
i
in
self
.
_fixed_params
])
if
title
is
not
None
and
title
.
replace
(
'
'
,
''
):
title
=
r
"
EPSC with %s = %s
"
%
(
mpl
.
title
(
title
or
(
r
"
EPSC with $\beta$ = %.2f
"
%
r
"
$\beta$
"
if
self
.
_var_param
==
'
omega
'
else
r
"
$\omega$
"
,
str_list
self
.
_fixed_param
))
)
else
:
if
self
.
_titles
is
not
None
and
len
(
self
.
_titles
)
>
idx
:
if
title
is
not
None
and
title
.
replace
(
'
'
,
''
):
title
=
self
.
_titles
[
idx
]
if
self
.
_titles
[
idx
].
replace
(
'
'
,
''
)
\
mpl
.
title
(
title
or
(
r
"
EPSC with $\omega$ = %.2f
"
%
else
None
self
.
_fixed_param
))
mpl
.
title
(
title
)
mpl
.
grid
()
mpl
.
grid
()
self
.
_plot_legends
()
self
.
_plot_legends
()
ax1
.
set_xticklabels
(
ax1
.
get_xticks
())
ax
=
mpl
.
gca
()
ax1
.
set_yticklabels
(
ax1
.
get_yticks
())
ax
.
set_xticklabels
(
ax
.
get_xticks
())
ax
.
set_yticklabels
(
ax
.
get_yticks
())
mpl
.
xticks
(
rotation
=
self
.
_x_rotation
)
mpl
.
xticks
(
rotation
=
self
.
_x_rotation
)
self
.
_pdf_page
.
savefig
()
self
.
_pdf_page
.
savefig
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment