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

Merge branch 'fix-checkpoint' into 'dask-pipelines'

Removed the -T hack from gabor_graph

See merge request !68
parents 52caba64 3288ba13
No related branches found
No related tags found
2 merge requests!68Removed the -T hack from gabor_graph,!64Dask pipelines
Pipeline #42285 failed
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
......@@ -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
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