From a50ff7e35a4ed1d9259f3f83789296742ef566c4 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sat, 20 Jan 2024 19:27:08 +0000 Subject: [PATCH] deprecated module retired --- deepface/commons/functions.py | 53 ----------------------------------- 1 file changed, 53 deletions(-) diff --git a/deepface/commons/functions.py b/deepface/commons/functions.py index 520251d..64f8e06 100644 --- a/deepface/commons/functions.py +++ b/deepface/commons/functions.py @@ -340,56 +340,3 @@ def find_target_size(model_name: str) -> tuple: raise ValueError(f"unimplemented model name - {model_name}") return target_size - - -# --------------------------------------------------- -# deprecated functions - - -@deprecated(version="0.0.78", reason="Use extract_faces instead of preprocess_face") -def preprocess_face( - img: Union[str, np.ndarray], - target_size=(224, 224), - detector_backend="opencv", - grayscale=False, - enforce_detection=True, - align=True, -) -> Union[np.ndarray, None]: - """ - Preprocess only one face - - Args: - img (str or numpy): the input image. - target_size (tuple, optional): the target size. Defaults to (224, 224). - detector_backend (str, optional): the detector backend. Defaults to "opencv". - grayscale (bool, optional): whether to convert to grayscale. Defaults to False. - enforce_detection (bool, optional): whether to enforce face detection. Defaults to True. - align (bool, optional): whether to align the face. Defaults to True. - - Returns: - loaded image (numpt): the preprocessed face. - - Raises: - ValueError: if face is not detected and enforce_detection is True. - - Deprecated: - 0.0.78: Use extract_faces instead of preprocess_face. - """ - logger.warn("Function preprocess_face is deprecated. Use extract_faces instead.") - result = None - img_objs = extract_faces( - img=img, - target_size=target_size, - detector_backend=detector_backend, - grayscale=grayscale, - enforce_detection=enforce_detection, - align=align, - ) - - if len(img_objs) > 0: - result, _, _ = img_objs[0] - # discard expanded dimension - if len(result.shape) == 4: - result = result[0] - - return result