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

[py] SampleSet key or 1st Sample key in checkpoint

Uses a sample's key if key is not an attribute of the sampleset.
parent e6cfce35
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
......@@ -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