Skip to content
Snippets Groups Projects
Commit 89064087 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Used the ScoreWriter to do the score concatenation

parent 54162c97
No related branches found
No related tags found
2 merge requests!185Wrappers and aggregators,!180[dask] Preparing bob.bio.base for dask pipelines
...@@ -158,7 +158,6 @@ def vanilla_biometrics(pipeline, database, dask_client, groups, output, **kwargs ...@@ -158,7 +158,6 @@ def vanilla_biometrics(pipeline, database, dask_client, groups, output, **kwargs
biometric_references = database.references(group=group) biometric_references = database.references(group=group)
logger.info(f"Running vanilla biometrics for group {group}") logger.info(f"Running vanilla biometrics for group {group}")
allow_scoring_with_all_biometric_references = ( allow_scoring_with_all_biometric_references = (
database.allow_scoring_with_all_biometric_references database.allow_scoring_with_all_biometric_references
if hasattr(database, "allow_scoring_with_all_biometric_references") if hasattr(database, "allow_scoring_with_all_biometric_references")
...@@ -182,14 +181,15 @@ def vanilla_biometrics(pipeline, database, dask_client, groups, output, **kwargs ...@@ -182,14 +181,15 @@ def vanilla_biometrics(pipeline, database, dask_client, groups, output, **kwargs
result = result.compute(scheduler="single-threaded") result = result.compute(scheduler="single-threaded")
# Check if there's a score writer hooked in # Check if there's a score writer hooked in
if isinstance(pipeline.biometric_algorithm, BioAlgorithmCheckpointWrapper): if hasattr(pipeline.biometric_algorithm, "score_writer"):
pipeline.biometric_algorithm.score_writer.concatenate_write_scores(result, score_file_name) pipeline.biometric_algorithm.score_writer.concatenate_write_scores(result, score_file_name)
else: else:
# Flatting out the list with open(score_file_name, "w") as f:
result = itertools.chain(*result) # Flatting out the list
for probe in result: result = itertools.chain(*result)
for sample in probe.samples: for probe in result:
f.write(sample.data) for sample in probe.samples:
f.writelines(sample.data)
if dask_client is not None: if dask_client is not None:
dask_client.shutdown() dask_client.shutdown()
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