Skip to content
Snippets Groups Projects
Commit 0a913967 authored by Yannick DAYER's avatar Yannick DAYER
Browse files

Merge branch 'fix-sampleset-key' into 'master'

Use the SampleSet key or the first Sample key in checkpoint wrapper

Closes #190

See merge request !319
parents 666b29c7 9b018359
No related branches found
No related tags found
1 merge request!319Use the SampleSet key or the first Sample key in checkpoint wrapper
Pipeline #73337 passed
......@@ -86,7 +86,7 @@ class BioAlgCheckpointWrapper(BioAlgorithmBaseWrapper):
to h5py.
group
group of the data (?) TODO document
group of the data, used to save different group's checkpoints in different dirs.
force
If True, will recompute scores and biometric references no matter if a file
......@@ -155,15 +155,18 @@ class BioAlgCheckpointWrapper(BioAlgorithmBaseWrapper):
Enroll a sample set with checkpointing
"""
# If sampleset has a key use it, otherwise use the first sample's key
model_key = getattr(sampleset, "key", sampleset.samples[0].key)
# Amending `models` directory
hash_dir_name = (
self.hash_fn(str(sampleset.key)) if self.hash_fn is not None else ""
self.hash_fn(str(model_key)) if self.hash_fn is not None else ""
)
path = os.path.join(
self.biometric_reference_dir,
hash_dir_name,
str(sampleset.key) + self.extension,
str(model_key) + self.extension,
)
if self.force or not os.path.exists(path):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment