Commit 51f89e6a authored by Theophile GENTILHOMME's avatar Theophile GENTILHOMME

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

parent af17ccd9
Pipeline #19948 failed with stage
in 42 minutes and 59 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!")
......@@ -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