Skip to content
Snippets Groups Projects
Commit 293db954 authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME
Browse files

Change DIC to DIR, add old evaluate.py guoide information

parent e5c36eef
No related branches found
No related tags found
1 merge request!146Add 4-5-col files related functionalities and add click commands
Pipeline #
...@@ -18,7 +18,7 @@ def rank_option(**kwargs): ...@@ -18,7 +18,7 @@ def rank_option(**kwargs):
return value return value
return click.option( return click.option(
'-rk', '--rank', type=click.INT, default=1, '-rk', '--rank', type=click.INT, default=1,
help='Rank for DIC', help='Provide rank for the command',
callback=callback, show_default=True, **kwargs)(func) callback=callback, show_default=True, **kwargs)(func)
return custom_rank_option return custom_rank_option
...@@ -231,7 +231,7 @@ def cmc(ctx, scores, evaluation, **kargs): ...@@ -231,7 +231,7 @@ def cmc(ctx, scores, evaluation, **kargs):
@common_options.figsize_option() @common_options.figsize_option()
@verbosity_option() @verbosity_option()
@click.pass_context @click.pass_context
def dic(ctx, scores, evaluation, **kargs): def dir(ctx, scores, evaluation, **kargs):
"""Plots the Detection & Identification curve over the FAR """Plots the Detection & Identification curve over the FAR
This curve is designed to be used in an open set identification protocol, and This curve is designed to be used in an open set identification protocol, and
...@@ -255,14 +255,14 @@ def dic(ctx, scores, evaluation, **kargs): ...@@ -255,14 +255,14 @@ def dic(ctx, scores, evaluation, **kargs):
:py:func:`bob.bio.base.score.load.five_column` for details. :py:func:`bob.bio.base.score.load.five_column` for details.
Examples: Examples:
$ bob bio dic dev-scores $ bob bio dir dev-scores
$ bob bio dic dev-scores1 eval-scores1 dev-scores2 $ bob bio dir dev-scores1 eval-scores1 dev-scores2
eval-scores2 eval-scores2
$ bob bio dic -o my_roc.pdf dev-scores1 eval-scores1 $ bob bio dir -o my_roc.pdf dev-scores1 eval-scores1
""" """
process = bio_figure.Dic(ctx, scores, evaluation, load.cmc) process = bio_figure.Dir(ctx, scores, evaluation, load.cmc)
process.run() process.run()
@click.command() @click.command()
......
...@@ -65,19 +65,19 @@ class Cmc(measure_figure.PlotBase): ...@@ -65,19 +65,19 @@ class Cmc(measure_figure.PlotBase):
) )
self._max_R = max(rank, self._max_R) self._max_R = max(rank, self._max_R)
class Dic(measure_figure.PlotBase): class Dir(measure_figure.PlotBase):
''' Handles the plotting of DIC''' ''' Handles the plotting of DIR curve'''
def __init__(self, ctx, scores, evaluation, func_load): def __init__(self, ctx, scores, evaluation, func_load):
super(Dic, self).__init__(ctx, scores, evaluation, func_load) super(Dir, self).__init__(ctx, scores, evaluation, func_load)
self._semilogx = True if 'semilogx' not in ctx.meta else\ self._semilogx = True if 'semilogx' not in ctx.meta else\
ctx.meta['semilogx'] ctx.meta['semilogx']
self._rank = 1 if 'rank' not in ctx.meta else ctx.meta['rank'] self._rank = 1 if 'rank' not in ctx.meta else ctx.meta['rank']
self._title = self._title or 'DIC' self._title = self._title or 'DIR curve'
self._x_label = self._title or 'FAR' self._x_label = self._title or 'FAR'
self._y_label = self._title or 'DIR' self._y_label = self._title or 'DIR'
def compute(self, idx, input_scores, input_names): def compute(self, idx, input_scores, input_names):
''' Plot DIC for dev and eval data using ''' Plot DIR for dev and eval data using
:py:func:`bob.measure.plot.detection_identification_curve`''' :py:func:`bob.measure.plot.detection_identification_curve`'''
mpl.figure(1) mpl.figure(1)
if self._eval: if self._eval:
......
...@@ -224,19 +224,19 @@ def test_cmc(): ...@@ -224,19 +224,19 @@ def test_cmc():
click.echo(result.output) click.echo(result.output)
assert result.exit_code == 0, (result.exit_code, result.output) assert result.exit_code == 0, (result.exit_code, result.output)
def test_dic(): def test_dir():
dev1 = pkg_resources.resource_filename('bob.bio.base.test', dev1 = pkg_resources.resource_filename('bob.bio.base.test',
'data/scores-nonorm-openset-dev') 'data/scores-nonorm-openset-dev')
runner = CliRunner() runner = CliRunner()
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.dic, ['--no-evaluation', dev1, '--rank', 2]) result = runner.invoke(commands.dir, ['--no-evaluation', dev1, '--rank', 2])
if result.output: if result.output:
click.echo(result.output) click.echo(result.output)
assert result.exit_code == 0, (result.exit_code, result.output) assert result.exit_code == 0, (result.exit_code, result.output)
test1 = pkg_resources.resource_filename('bob.bio.base.test', test1 = pkg_resources.resource_filename('bob.bio.base.test',
'data/scores-nonorm-openset-dev') 'data/scores-nonorm-openset-dev')
with runner.isolated_filesystem(): with runner.isolated_filesystem():
result = runner.invoke(commands.dic, ['--output', 'test.pdf', result = runner.invoke(commands.dir, ['--output', 'test.pdf',
'--titles', 'A,B', '--titles', 'A,B',
dev1, test1, dev1, test1]) dev1, test1, dev1, test1])
if result.output: if result.output:
......
...@@ -227,7 +227,7 @@ file containing the plots. Available plots are: ...@@ -227,7 +227,7 @@ file containing the plots. Available plots are:
* ``cmc`` (cumulative match characteristic curve) * ``cmc`` (cumulative match characteristic curve)
* ``dic`` (detection identification curve) * ``dir`` (detection identification rate)
Use the ``--help`` option on the above-cited commands to find-out about more Use the ``--help`` option on the above-cited commands to find-out about more
options. options.
...@@ -243,7 +243,7 @@ For example, to generate a CMC curve from development and evaluation datasets: ...@@ -243,7 +243,7 @@ For example, to generate a CMC curve from development and evaluation datasets:
where `my_cmc.pdf` will contain CMC curves for the two experiments. where `my_cmc.pdf` will contain CMC curves for the two experiments.
.. note:: .. note::
By default, ``det``, ``roc``, ``cmc`` and ``dic`` plot development and By default, ``det``, ``roc``, ``cmc`` and ``dir`` plot development and
evaluation curves on evaluation curves on
different plots. You can force gather everything in the same plot using different plots. You can force gather everything in the same plot using
``--no-split`` option. ``--no-split`` option.
...@@ -264,6 +264,24 @@ experiment. For example: ...@@ -264,6 +264,24 @@ experiment. For example:
will output metrics and plots for the two experiments (dev and eval pairs) in will output metrics and plots for the two experiments (dev and eval pairs) in
`my_metrics.txt` and `my_plots.pdf`, respectively. `my_metrics.txt` and `my_plots.pdf`, respectively.
Evaluate script (deprecated)
============================
After the experiment has finished successfully, one or more text file containing all the scores are written.
To evaluate the experiment, you can use the generic ``evaluate.py`` script, which has properties for all prevalent evaluation types, such as CMC, DIR, ROC and DET plots, as well as computing recognition rates, EER/HTER, Cllr and minDCF.
Additionally, a combination of different algorithms can be plotted into the same files.
Just specify all the score files that you want to evaluate using the ``--dev-files`` option, and possible legends for the plots (in the same order) using the ``--legends`` option, and the according plots will be generated.
For example, to create a ROC curve for the experiment above, use:
.. code-block:: sh
$ evaluate.py --dev-files results/pca-experiment/male/nonorm/scores-dev --legend MOBIO --roc MOBIO_MALE_ROC.pdf -vv
Please note that there exists another file called ``Experiment.info`` inside the result directory.
This file is a pure text file and contains the complete configuration of the experiment.
With this configuration it is possible to inspect all default parameters of the algorithms, and even to re-run the exact same experiment.
.. _running_in_parallel: .. _running_in_parallel:
Running in Parallel Running in Parallel
......
...@@ -113,7 +113,7 @@ Plotting ...@@ -113,7 +113,7 @@ Plotting
-------- --------
.. autosummary:: .. autosummary::
bob.bio.base.script.figure.Cmc bob.bio.base.script.figure.Cmc
bob.bio.base.script.figure.Dic bob.bio.base.script.figure.Dir
bob.bio.base.script.figure.Hist bob.bio.base.script.figure.Hist
OpenBR conversions OpenBR conversions
......
...@@ -144,7 +144,7 @@ setup( ...@@ -144,7 +144,7 @@ setup(
'epc = bob.bio.base.script.commands:epc', 'epc = bob.bio.base.script.commands:epc',
'hist = bob.bio.base.script.commands:hist', 'hist = bob.bio.base.script.commands:hist',
'cmc = bob.bio.base.script.commands:cmc', 'cmc = bob.bio.base.script.commands:cmc',
'dic = bob.bio.base.script.commands:dic', 'dir = bob.bio.base.script.commands:dir',
'gen = bob.bio.base.script.gen:gen', 'gen = bob.bio.base.script.gen:gen',
'evaluate = bob.bio.base.script.commands:evaluate', 'evaluate = bob.bio.base.script.commands:evaluate',
], ],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment