mirror of
https://github.com/serengil/deepface.git
synced 2025-06-05 19:15:23 +00:00
external tests
This commit is contained in:
parent
bb7242645e
commit
6263cef831
@ -48,13 +48,19 @@ if tf_version == 2:
|
|||||||
folder_utils.initialize_folder()
|
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:
|
Args:
|
||||||
model_name (string): face recognition, facial attribute or face detector model
|
model_name (str): model identifier
|
||||||
VGG-Face, Facenet, OpenFace, DeepFace, DeepID for face recognition
|
- VGG-Face, Facenet, Facenet512, OpenFace, DeepFace, DeepID, Dlib,
|
||||||
Age, Gender, Emotion, Race for facial attributes
|
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:
|
Returns:
|
||||||
built_model
|
built_model
|
||||||
"""
|
"""
|
||||||
|
@ -97,6 +97,6 @@ def build_model(task: str, model_name: str) -> Any:
|
|||||||
if model:
|
if model:
|
||||||
model_obj[task][model_name] = model()
|
model_obj[task][model_name] = model()
|
||||||
else:
|
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]
|
return model_obj[task][model_name]
|
||||||
|
@ -16,7 +16,7 @@ logger = Logger()
|
|||||||
|
|
||||||
model_name = "VGG-Face"
|
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
|
target_size = model.input_shape
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user