external tests

This commit is contained in:
Sefik Ilkin Serengil 2024-08-04 11:47:10 +01:00
parent bb7242645e
commit 6263cef831
3 changed files with 13 additions and 7 deletions

View File

@ -48,13 +48,19 @@ if tf_version == 2:
folder_utils.initialize_folder()
def build_model(task: str, model_name: str) -> Any:
def build_model(model_name: str, task: str = "facial_recognition") -> Any:
"""
This function builds a deepface model
This function builds a pre-trained model
Args:
model_name (string): face recognition, facial attribute or face detector model
VGG-Face, Facenet, OpenFace, DeepFace, DeepID for face recognition
Age, Gender, Emotion, Race for facial attributes
model_name (str): model identifier
- VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib,
ArcFace, SFace, GhostFaceNet for face recognition
- Age, Gender, Emotion, Race for facial attributes
- opencv, mtcnn, ssd, dlib, retinaface, mediapipe, yolov8, yunet,
fastmtcnn or centerface for face detectors
- Fasnet for spoofing
task (str): facial_recognition, facial_attribute, face_detector, spoofing
default is facial_recognition
Returns:
built_model
"""

View File

@ -97,6 +97,6 @@ def build_model(task: str, model_name: str) -> Any:
if model:
model_obj[task][model_name] = model()
else:
raise ValueError(f"Invalid model_name passed - {model_name}")
raise ValueError(f"Invalid model_name passed - {task}/{model_name}")
return model_obj[task][model_name]

View File

@ -16,7 +16,7 @@ logger = Logger()
model_name = "VGG-Face"
model: FacialRecognition = DeepFace.build_model(model_name=model_name)
model: FacialRecognition = DeepFace.build_model(task="facial_recognition", model_name=model_name)
target_size = model.input_shape