Skip to content
Snippets Groups Projects
Commit 9b018359 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 666b29c7
No related branches found
No related tags found
1 merge request!319Use the SampleSet key or the first Sample key in checkpoint wrapper
Pipeline #72158 passed
...@@ -86,7 +86,7 @@ class BioAlgCheckpointWrapper(BioAlgorithmBaseWrapper): ...@@ -86,7 +86,7 @@ class BioAlgCheckpointWrapper(BioAlgorithmBaseWrapper):
to h5py. to h5py.
group group
group of the data (?) TODO document group of the data, used to save different group's checkpoints in different dirs.
force force
If True, will recompute scores and biometric references no matter if a file If True, will recompute scores and biometric references no matter if a file
...@@ -155,15 +155,18 @@ class BioAlgCheckpointWrapper(BioAlgorithmBaseWrapper): ...@@ -155,15 +155,18 @@ class BioAlgCheckpointWrapper(BioAlgorithmBaseWrapper):
Enroll a sample set with checkpointing 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 # Amending `models` directory
hash_dir_name = ( 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( path = os.path.join(
self.biometric_reference_dir, self.biometric_reference_dir,
hash_dir_name, hash_dir_name,
str(sampleset.key) + self.extension, str(model_key) + self.extension,
) )
if self.force or not os.path.exists(path): 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