From fc296d9f846b10be249e085f2d39764c7ad1d381 Mon Sep 17 00:00:00 2001 From: Yannick DAYER <yannick.dayer@idiap.ch> Date: Tue, 11 Jul 2023 21:07:26 +0200 Subject: [PATCH] fix: minor refactor, add comments, remove old code --- experiments/score-norm/morph.py | 62 +++++++++++---------------------- 1 file changed, 20 insertions(+), 42 deletions(-) diff --git a/experiments/score-norm/morph.py b/experiments/score-norm/morph.py index fc1a514..0df30fd 100644 --- a/experiments/score-norm/morph.py +++ b/experiments/score-norm/morph.py @@ -27,7 +27,7 @@ from bob.bio.face.embeddings.mxnet import arcface_insightFace_lresnet100 from bob.bio.face.embeddings.opencv import vgg16_oxford_baseline -max_attempts = 2 +max_attempts = 1 logger = clapper.logging.setup("bob") logger.setLevel("DEBUG") @@ -77,19 +77,18 @@ baselines = [MobileFaceNet] from bob.bio.base.pipelines.entry_points import execute_pipeline_score_norm for bl in baselines: - print(f"Running {bl.__name__}....") def run(groups): - for i in range(max_attempts): - - IDIAP = False + IDIAP = True dask_client = None if IDIAP: from dask.distributed import Client - from bob.pipelines.distributed.sge import SGEMultipleQueuesCluster + from bob.pipelines.distributed.sge import ( + SGEMultipleQueuesCluster, + ) cluster = SGEMultipleQueuesCluster(min_jobs=1) dask_client = Client(cluster) @@ -99,13 +98,15 @@ for bl in baselines: OUTPUT_PATH, "score-norm", database_name, bl.__name__ ) + rec_pipeline = bl( + annotation_type=database.annotation_type, + fixed_positions=database.fixed_positions, + ) + try: - # New Z-norm + # Z-norm execute_pipeline_score_norm( - pipeline=bl( - annotation_type=database.annotation_type, - fixed_positions=database.fixed_positions - ), + pipeline=rec_pipeline, database=database, dask_client=dask_client, groups=groups, @@ -114,19 +115,15 @@ for bl in baselines: checkpoint=True, dask_partition_size=100, dask_n_workers=20, - top_norm=False, - # top_norm_score_fraction=0.8, + top_norm=False, # TODO set this? + # top_norm_score_fraction=0.8, # TODO: and this? score_normalization_type="znorm", - # consider_genuines=False, - # ztnorm_cohort_proportion=1.0, + # consider_genuines=False, # TODO: find if equivalent exists in new ) - # New T-norm + # T-norm execute_pipeline_score_norm( - pipeline=bl( - annotation_type=database.annotation_type, - fixed_positions=database.fixed_positions - ), + pipeline=rec_pipeline, database=database, dask_client=dask_client, groups=groups, @@ -135,30 +132,12 @@ for bl in baselines: checkpoint=True, dask_partition_size=100, dask_n_workers=40, - top_norm=False, - # top_norm_score_fraction=0.8, + top_norm=False, # TODO set this? + # top_norm_score_fraction=0.8, # TODO: and this? score_normalization_type="tnorm", - # consider_genuines=False, - # ztnorm_cohort_proportion=1.0, + # consider_genuines=False, # TODO: find if equivalent exists in new ) - # ORIGINAL - # execute_vanilla_biometrics_ztnorm( - # bl( - # annotation_type=database.annotation_type, - # fixed_positions=database.fixed_positions, - # ), - # database, - # dask_client, - # groups=groups, - # output=output_path, - # write_metadata_scores=True, - # checkpoint=True, - # dask_partition_size=100, - # dask_n_workers=20, - # consider_genuines=consider_genuines, - # ztnorm_cohort_proportion=ztnorm_cohort_proportion, - # ) break except Exception as e: @@ -168,6 +147,5 @@ for bl in baselines: dask_client.close() cluster.close() - # run(groups=["dev"]) run(groups=["dev", "eval"]) print(f"Done!") -- GitLab