Commit 9e8ee358 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira

Merge branch 'fixmoving' into 'master'

Fix bob.measure->bob.bio.base related issues

See merge request !13
parents af17ccd9 4a69e538
Pipeline #21404 passed with stages
in 12 minutes and 29 seconds
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""Converts the 4 columns score format to the NIST format.
Each row of the NIST format is composed of the following fields:
* ENROLL_TEMPLATE_ID
* VERIF_TEMPLATE_ID
* ENROLL_TEMPLATE_SIZE_BYTES
* VERIF_TEMPLATE_SIZE_BYTES
* RETCODE
* SIMILARITY_SCORE
Usage:
score_generation.py <input-scores> <output-scores> [--template-size=<n>]
score_generation.py -h | --help
Arguments:
<input-scores> Path to input score files
<output-scores> Path to output score files
Options:
-h --help Show this screen.
--template-size=<n> The default template size in BYTES [default: 100]
"""
from docopt import docopt
import bob.measure
import os
import bob.io.base
def main(command_line_parameters=None):
args = docopt(__doc__, version='NIST Score Generation')
template_size = int(args['--template-size'])
output_file = args['<output-scores>']
bob.io.base.create_directories_safe(os.path.dirname(output_file))
print("Writing scores in {0}".format(output_file))
f = open(output_file,'w')
f.write('ENROLL_TEMPLATE_ID VERIF_TEMPLATE_ID ENROLL_TEMPLATE_SIZE_BYTES VERIF_TEMPLATE_SIZE_BYTES RETCODE SIMILARITY_SCORE\n')
for template_id,probe_id,template_file,score in bob.measure.load.four_column(args['<input-scores>']):
f.write("{0} {1} {2} {3} 0 {4}\n".format(template_id, probe_id, template_size, template_size, score))
del f
print("Done!")
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
"""Converts the 4 columns score format to the NIST format.
Each row of the NIST format is composed of the following fields:
* ENROLL_TEMPLATE_ID
* VERIF_TEMPLATE_ID
* ENROLL_TEMPLATE_SIZE_BYTES
* VERIF_TEMPLATE_SIZE_BYTES
* RETCODE
* SIMILARITY_SCORE
Usage:
score_generation.py <input-scores> <output-scores> [--template-size=<n>]
score_generation.py -h | --help
Arguments:
<input-scores> Path to input score files
<output-scores> Path to output score files
Options:
-h --help Show this screen.
--template-size=<n> The default template size in BYTES [default: 100]
"""
from docopt import docopt
import bob.bio.base
import os
import bob.io.base
def main(command_line_parameters=None):
args = docopt(__doc__, version='NIST Score Generation')
template_size = int(args['--template-size'])
output_file = args['<output-scores>']
bob.io.base.create_directories_safe(os.path.dirname(output_file))
print("Writing scores in {0}".format(output_file))
f = open(output_file,'w')
f.write('ENROLL_TEMPLATE_ID VERIF_TEMPLATE_ID ENROLL_TEMPLATE_SIZE_BYTES VERIF_TEMPLATE_SIZE_BYTES RETCODE SIMILARITY_SCORE\n')
for template_id,probe_id,template_file,score in bob.bio.base.score.load.four_column(args['<input-scores>']):
f.write("{0} {1} {2} {3} 0 {4}\n".format(template_id, probe_id, template_size, template_size, score))
del f
print("Done!")
......@@ -28,6 +28,7 @@ requirements:
- bob.blitz
- bob.io.base
- bob.db.base
- bob.bio.base
- bob.measure
- docopt {{ docopt }}
run:
......
......@@ -99,7 +99,7 @@ NIST Score Generation
=====================
NIST has a specific file format to encode the scores of the comparisons.
This package contains a feature to convert the Bob 4 column format (`bob.measure.load.four_column`) to the NIST format.
This package contains a feature to convert the Bob 4 column format (`bob.bio.base.score.load.four_column`) to the NIST format.
To do so, run the following command:
.. code-block:: bash
......
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