mirror of
https://github.com/serengil/deepface.git
synced 2025-06-08 12:35:22 +00:00
deprecated module retired
This commit is contained in:
parent
25a3061ae9
commit
a50ff7e35a
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user