diff --git a/bob/bio/face/config/baseline/gabor_graph.py b/bob/bio/face/config/baseline/gabor_graph.py index 8e6b978ff1bc3b23c5952a1de0d1ce418f27b849..2798fb5e07a76d21444f688ec0d67dc75f4cb1f4 100644 --- a/bob/bio/face/config/baseline/gabor_graph.py +++ b/bob/bio/face/config/baseline/gabor_graph.py @@ -1,8 +1,7 @@ from bob.bio.base.pipelines.vanilla_biometrics import ( Distance, VanillaBiometricsPipeline, - BioAlgorithmLegacy, - temp_directory + BioAlgorithmLegacy, ) from bob.bio.face.config.baseline.helpers import crop_80x64 import math @@ -26,7 +25,7 @@ else: fixed_positions = None -def load(annotation_type, fixed_positions=None, checkpoints_dir=None): +def load(annotation_type, fixed_positions=None): ####### SOLVING THE FACE CROPPER TO BE USED ########## # Cropping @@ -77,26 +76,9 @@ def load(annotation_type, fixed_positions=None, checkpoints_dir=None): # if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx tempdir = tempfile.TemporaryDirectory().name - # Replace the default if provided - if checkpoints_dir is not None: - try: - os.makedirs(checkpoints_dir, exist_ok=True) - except OSError: - logger.info( - "Could not create directory '{}'.".format(checkpoints_dir) - + " Using default ('{}').".format(tempdir) - ) - else: - tempdir = checkpoints_dir - algorithm = BioAlgorithmLegacy(gabor_jet, base_dir=tempdir) return VanillaBiometricsPipeline(transformer, algorithm) -try: temp_directory -except NameError: - logger.info("Temporary directory not defined. Using default.") - pipeline = load(annotation_type, fixed_positions, None) -else: - pipeline = load(annotation_type, fixed_positions, temp_directory) +pipeline = load(annotation_type, fixed_positions) transformer = pipeline.transformer diff --git a/bob/bio/face/config/baseline/lda.py b/bob/bio/face/config/baseline/lda.py index 74705abc5694b29e0ab613f9deec642e09ebf732..660599458aa4ed09fb968b7c17a71c530b3e2c48 100644 --- a/bob/bio/face/config/baseline/lda.py +++ b/bob/bio/face/config/baseline/lda.py @@ -2,7 +2,6 @@ from bob.bio.base.pipelines.vanilla_biometrics import ( Distance, VanillaBiometricsPipeline, BioAlgorithmLegacy, - temp_directory ) from bob.bio.face.config.baseline.helpers import crop_80x64 import numpy as np @@ -28,7 +27,7 @@ else: ####### SOLVING THE FACE CROPPER TO BE USED ########## -def load(annotation_type, fixed_positions=None, checkpoints_dir=None): +def load(annotation_type, fixed_positions=None): # Cropping face_cropper, transform_extra_arguments = crop_80x64( @@ -50,18 +49,6 @@ def load(annotation_type, fixed_positions=None, checkpoints_dir=None): # if /idiap/temp/<USER> does not exist, use /tmp/tmpxxxxxxxx tempdir = tempfile.TemporaryDirectory().name - # Replace the default if provided - if checkpoints_dir is not None: - try: - os.makedirs(checkpoints_dir, exist_ok=True) - except OSError: - logger.info( - "Could not create directory '{}'.".format(checkpoints_dir) - + " Using default ('{}').".format(tempdir) - ) - else: - tempdir = checkpoints_dir - lda = bob.bio.base.algorithm.LDA(use_pinv=True, pca_subspace_dimension=0.90) lda_transformer = AlgorithmTransformer( @@ -88,10 +75,6 @@ def load(annotation_type, fixed_positions=None, checkpoints_dir=None): return VanillaBiometricsPipeline(transformer, algorithm) -try: temp_directory -except NameError: - logger.info("Temporary directory not defined. Using default.") - pipeline = load(annotation_type, fixed_positions, None) -else: - pipeline = load(annotation_type, fixed_positions, temp_directory) +pipeline = load(annotation_type, fixed_positions) + transformer = pipeline.transformer