From 5c1bf67507357f79dc4fc438197d7aa6f9b754de Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sun, 4 Aug 2024 11:57:34 +0100 Subject: [PATCH] getting tasks dynamically --- deepface/modules/modeling.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/deepface/modules/modeling.py b/deepface/modules/modeling.py index d6cf6a9..0e76513 100644 --- a/deepface/modules/modeling.py +++ b/deepface/modules/modeling.py @@ -45,11 +45,6 @@ def build_model(task: str, model_name: str) -> Any: built model class """ - tasks = ["facial_recognition", "spoofing", "facial_attribute", "face_detector"] - - if task not in tasks: - raise ValueError(f"unimplemented task - {task}") - # singleton design pattern global model_obj @@ -89,8 +84,11 @@ def build_model(task: str, model_name: str) -> Any: }, } + if task not in models.keys(): + raise ValueError(f"unimplemented task - {task}") + if not "model_obj" in globals(): - model_obj = {current_task: {} for current_task in tasks} + model_obj = {current_task: {} for current_task in models.keys()} if not model_name in model_obj[task].keys(): model = models[task].get(model_name)