mirror of
https://github.com/serengil/deepface.git
synced 2025-06-05 19:15:23 +00:00
deprecated functions added
This commit is contained in:
parent
0f913adde9
commit
d04ab28bd3
9
api/api.py
Normal file
9
api/api.py
Normal file
@ -0,0 +1,9 @@
|
||||
import argparse
|
||||
import app
|
||||
|
||||
if __name__ == "__main__":
|
||||
deepface_app = app.create_app()
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("-p", "--port", type=int, default=5000, help="Port of serving api")
|
||||
args = parser.parse_args()
|
||||
deepface_app.run(host="0.0.0.0", port=args.port)
|
@ -808,6 +808,30 @@ def extract_faces(
|
||||
return resp_objs
|
||||
|
||||
|
||||
# ---------------------------
|
||||
# deprecated functions
|
||||
|
||||
|
||||
def detectFace(
|
||||
img_path, target_size=(224, 224), detector_backend="opencv", enforce_detection=True, align=True
|
||||
):
|
||||
print("⚠️ Function detectFace is deprecated! Use extract_faces instead of this.")
|
||||
|
||||
face_objs = extract_faces(
|
||||
img_path=img_path,
|
||||
target_size=target_size,
|
||||
detector_backend=detector_backend,
|
||||
enforce_detection=enforce_detection,
|
||||
align=align,
|
||||
grayscale=False,
|
||||
)
|
||||
|
||||
extracted_face = None
|
||||
if len(face_objs) > 0:
|
||||
extracted_face = face_objs[0]["face"]
|
||||
return extracted_face
|
||||
|
||||
|
||||
# ---------------------------
|
||||
# main
|
||||
|
||||
|
@ -251,3 +251,35 @@ def find_target_size(model_name):
|
||||
raise ValueError(f"unimplemented model name - {model_name}")
|
||||
|
||||
return target_size
|
||||
|
||||
|
||||
# ---------------------------------------------------
|
||||
# deprecated functions
|
||||
|
||||
|
||||
def preprocess_face(
|
||||
img,
|
||||
target_size=(224, 224),
|
||||
detector_backend="opencv",
|
||||
grayscale=False,
|
||||
enforce_detection=True,
|
||||
align=True,
|
||||
):
|
||||
print("⚠️ Function preprocess_face function is deprecated! Use extract_faces instead of this.")
|
||||
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
|
||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
||||
|
||||
setuptools.setup(
|
||||
name="deepface",
|
||||
version="0.0.78",
|
||||
version="0.0.79",
|
||||
author="Sefik Ilkin Serengil",
|
||||
author_email="serengil@gmail.com",
|
||||
description="A Lightweight Face Recognition and Facial Attribute Analysis Framework (Age, Gender, Emotion, Race) for Python",
|
||||
|
Loading…
x
Reference in New Issue
Block a user