Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
bob.measure
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bob
bob.measure
Commits
51c0f8f4
Commit
51c0f8f4
authored
Apr 30, 2018
by
Theophile GENTILHOMME
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change option titles->legends; fix bug: incorrect reading of input files
parent
cf03a121
Pipeline
#19601
canceled with stage
in 49 seconds
Changes
4
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
26 deletions
+26
-26
bob/measure/script/commands.py
bob/measure/script/commands.py
+6
-6
bob/measure/script/common_options.py
bob/measure/script/common_options.py
+8
-8
bob/measure/script/figure.py
bob/measure/script/figure.py
+8
-8
bob/measure/test_script.py
bob/measure/test_script.py
+4
-4
No files found.
bob/measure/script/commands.py
View file @
51c0f8f4
...
...
@@ -16,7 +16,7 @@ from bob.extension.scripts.click_helper import (verbosity_option,
@
common_options
.
criterion_option
()
@
common_options
.
thresholds_option
()
@
common_options
.
far_option
()
@
common_options
.
title
s_option
()
@
common_options
.
legend
s_option
()
@
open_file_mode_option
()
@
verbosity_option
()
@
click
.
pass_context
...
...
@@ -43,7 +43,7 @@ def metrics(ctx, scores, evaluation, **kwargs):
@
click
.
command
()
@
common_options
.
scores_argument
(
nargs
=-
1
)
@
common_options
.
title_option
()
@
common_options
.
title
s_option
()
@
common_options
.
legend
s_option
()
@
common_options
.
sep_dev_eval_option
()
@
common_options
.
output_plot_file_option
(
default_out
=
'roc.pdf'
)
@
common_options
.
eval_option
()
...
...
@@ -83,7 +83,7 @@ def roc(ctx, scores, evaluation, **kwargs):
@
common_options
.
scores_argument
(
nargs
=-
1
)
@
common_options
.
output_plot_file_option
(
default_out
=
'det.pdf'
)
@
common_options
.
title_option
()
@
common_options
.
title
s_option
()
@
common_options
.
legend
s_option
()
@
common_options
.
sep_dev_eval_option
()
@
common_options
.
eval_option
()
@
common_options
.
axes_val_option
(
dflt
=
[
0.01
,
95
,
0.01
,
95
])
...
...
@@ -121,7 +121,7 @@ def det(ctx, scores, evaluation, **kwargs):
@
common_options
.
scores_argument
(
min_arg
=
1
,
force_eval
=
True
,
nargs
=-
1
)
@
common_options
.
output_plot_file_option
(
default_out
=
'epc.pdf'
)
@
common_options
.
title_option
()
@
common_options
.
title
s_option
()
@
common_options
.
legend
s_option
()
@
common_options
.
points_curve_option
()
@
common_options
.
const_layout_option
()
@
common_options
.
x_label_option
()
...
...
@@ -158,7 +158,7 @@ def epc(ctx, scores, **kwargs):
@
common_options
.
show_dev_option
()
@
common_options
.
print_filenames_option
()
@
common_options
.
title_option
()
@
common_options
.
title
s_option
()
@
common_options
.
legend
s_option
()
@
common_options
.
figsize_option
()
@
common_options
.
style_option
()
@
verbosity_option
()
...
...
@@ -189,7 +189,7 @@ def hist(ctx, scores, evaluation, **kwargs):
@
click
.
command
()
@
common_options
.
scores_argument
(
nargs
=-
1
)
@
common_options
.
title
s_option
()
@
common_options
.
legend
s_option
()
@
common_options
.
sep_dev_eval_option
()
@
common_options
.
table_option
()
@
common_options
.
eval_option
()
...
...
bob/measure/script/common_options.py
View file @
51c0f8f4
...
...
@@ -288,7 +288,7 @@ def figsize_option(**kwargs):
plt
.
rcParams
[
'figure.figsize'
]
=
ctx
.
meta
[
'figsize'
]
return
value
return
click
.
option
(
'--figsize'
,
help
=
'If given, will run '
'--figsize'
,
default
=
'4,3'
,
help
=
'If given, will run '
'``plt.rcParams[
\
'
figure.figsize
\
'
]=figsize)``. Example: --fig-size 4,6'
,
callback
=
callback
,
**
kwargs
)(
func
)
return
custom_figsize_option
...
...
@@ -341,20 +341,20 @@ def marker_style_option(**kwargs):
callback
=
callback
,
**
kwargs
)(
func
)
return
custom_marker_style_option
def
title
s_option
(
**
kwargs
):
'''Get the
title
s option for the different systems'''
def
custom_
title
s_option
(
func
):
def
legend
s_option
(
**
kwargs
):
'''Get the
legend
s option for the different systems'''
def
custom_
legend
s_option
(
func
):
def
callback
(
ctx
,
param
,
value
):
if
value
is
not
None
:
value
=
value
.
split
(
','
)
ctx
.
meta
[
'
title
s'
]
=
value
ctx
.
meta
[
'
legend
s'
]
=
value
return
value
return
click
.
option
(
'-
ts'
,
'--title
s'
,
type
=
click
.
STRING
,
default
=
None
,
'-
ls'
,
'--legend
s'
,
type
=
click
.
STRING
,
default
=
None
,
help
=
'The title for each system comma separated. '
'Example: --
title
s ISV,CNN'
,
'Example: --
legend
s ISV,CNN'
,
callback
=
callback
,
**
kwargs
)(
func
)
return
custom_
title
s_option
return
custom_
legend
s_option
def
title_option
(
**
kwargs
):
'''Get the title option for the different systems'''
...
...
bob/measure/script/figure.py
View file @
51c0f8f4
...
...
@@ -56,7 +56,7 @@ class MeasureBase(object):
self
.
_min_arg
=
1
if
'min_arg'
not
in
ctx
.
meta
else
ctx
.
meta
[
'min_arg'
]
self
.
_ctx
=
ctx
self
.
func_load
=
func_load
self
.
_
titles
=
None
if
'titles'
not
in
ctx
.
meta
else
ctx
.
meta
[
'title
s'
]
self
.
_
legends
=
None
if
'legends'
not
in
ctx
.
meta
else
ctx
.
meta
[
'legend
s'
]
self
.
_eval
=
evaluation
self
.
_min_arg
=
1
if
'min_arg'
not
in
ctx
.
meta
else
ctx
.
meta
[
'min_arg'
]
if
len
(
scores
)
<
1
or
len
(
scores
)
%
self
.
_min_arg
!=
0
:
...
...
@@ -64,8 +64,8 @@ class MeasureBase(object):
'Number of argument must be a non-zero multiple of %d'
%
self
.
_min_arg
)
self
.
n_systems
=
int
(
len
(
scores
)
/
self
.
_min_arg
)
if
self
.
_
titles
is
not
None
and
len
(
self
.
_title
s
)
!=
self
.
n_systems
:
raise
click
.
BadParameter
(
"Number of
title
s must be equal to the "
if
self
.
_
legends
is
not
None
and
len
(
self
.
_legend
s
)
!=
self
.
n_systems
:
raise
click
.
BadParameter
(
"Number of
legend
s must be equal to the "
"number of systems"
)
def
run
(
self
):
...
...
@@ -85,7 +85,7 @@ class MeasureBase(object):
# each system
for
idx
in
range
(
self
.
n_systems
):
input_scores
,
input_names
=
self
.
_load_files
(
self
.
_scores
[
idx
:(
idx
+
self
.
_min_arg
)
]
self
.
_scores
[
idx
*
self
.
_min_arg
:(
idx
+
1
)
*
self
.
_min_arg
]
)
self
.
compute
(
idx
,
input_scores
,
input_names
)
#setup final configuration, plotting properties, ...
...
...
@@ -188,7 +188,7 @@ class Metrics(MeasureBase):
threshold
=
utils
.
get_thres
(
self
.
_criterion
,
dev_neg
,
dev_pos
,
self
.
_far
)
\
if
self
.
_thres
is
None
else
self
.
_thres
[
idx
]
title
=
self
.
_
titles
[
idx
]
if
self
.
_title
s
is
not
None
else
None
title
=
self
.
_
legends
[
idx
]
if
self
.
_legend
s
is
not
None
else
None
if
self
.
_thres
is
None
:
far_str
=
''
if
self
.
_criterion
==
'far'
and
self
.
_far
is
not
None
:
...
...
@@ -364,8 +364,8 @@ class PlotBase(MeasureBase):
#common protected functions
def
_label
(
self
,
base
,
name
,
idx
):
if
self
.
_
titles
is
not
None
and
len
(
self
.
_title
s
)
>
idx
:
return
self
.
_
title
s
[
idx
]
if
self
.
_
legends
is
not
None
and
len
(
self
.
_legend
s
)
>
idx
:
return
self
.
_
legend
s
[
idx
]
if
self
.
n_systems
>
1
:
return
base
+
(
" %d (%s)"
%
(
idx
+
1
,
name
))
return
base
+
(
" (%s)"
%
name
)
...
...
@@ -584,7 +584,7 @@ class Hist(PlotBase):
self
.
_pdf_page
.
savefig
(
fig
)
def
_get_title
(
self
,
idx
,
dev_file
,
eval_file
):
title
=
self
.
_
titles
[
idx
]
if
self
.
_title
s
is
not
None
else
None
title
=
self
.
_
legends
[
idx
]
if
self
.
_legend
s
is
not
None
else
None
if
title
is
None
:
title
=
self
.
_title_base
if
not
self
.
_print_fn
else
\
(
'%s
\
n
(%s)'
%
(
...
...
bob/measure/test_script.py
View file @
51c0f8f4
...
...
@@ -30,7 +30,7 @@ def test_metrics():
assert
result
.
exit_code
==
0
with
runner
.
isolated_filesystem
():
result
=
runner
.
invoke
(
commands
.
metrics
,
[
'-l'
,
'tmp'
,
dev1
,
test1
,
dev2
,
test2
,
'-
t
s'
,
commands
.
metrics
,
[
'-l'
,
'tmp'
,
dev1
,
test1
,
dev2
,
test2
,
'-
l
s'
,
'A,B'
]
)
assert
result
.
exit_code
==
0
,
(
result
.
exit_code
,
result
.
output
)
...
...
@@ -63,7 +63,7 @@ def test_roc():
with
runner
.
isolated_filesystem
():
result
=
runner
.
invoke
(
commands
.
roc
,
[
'--output'
,
'test.pdf'
,
'--
title
s'
,
'A,B'
,
'test.pdf'
,
'--
legend
s'
,
'A,B'
,
dev1
,
test1
,
dev2
,
test2
])
if
result
.
output
:
click
.
echo
(
result
.
output
)
...
...
@@ -83,7 +83,7 @@ def test_det():
test2
=
bob
.
io
.
base
.
test_utils
.
datafile
(
'test-2.txt'
,
'bob.measure'
)
with
runner
.
isolated_filesystem
():
result
=
runner
.
invoke
(
commands
.
det
,
[
'--split'
,
'--output'
,
'test.pdf'
,
'--
title
s'
,
'A,B'
,
'test.pdf'
,
'--
legend
s'
,
'A,B'
,
dev1
,
test1
,
dev2
,
test2
])
if
result
.
output
:
click
.
echo
(
result
.
output
)
...
...
@@ -111,7 +111,7 @@ def test_epc():
test2
=
bob
.
io
.
base
.
test_utils
.
datafile
(
'test-2.txt'
,
'bob.measure'
)
with
runner
.
isolated_filesystem
():
result
=
runner
.
invoke
(
commands
.
epc
,
[
'--output'
,
'test.pdf'
,
'--
title
s'
,
'A,B'
,
'--
legend
s'
,
'A,B'
,
dev1
,
test1
,
dev2
,
test2
])
if
result
.
output
:
click
.
echo
(
result
.
output
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment