mirror of
https://github.com/serengil/deepface.git
synced 2025-07-24 02:40:00 +00:00
cleaner codes
This commit is contained in:
parent
2d39ade138
commit
e679c7206a
@ -434,7 +434,8 @@ disable=raw-checker-failed,
|
||||
cyclic-import,
|
||||
global-statement,
|
||||
no-member,
|
||||
no-name-in-module
|
||||
no-name-in-module,
|
||||
unrecognized-option
|
||||
|
||||
# Enable the message, report, category or checker with the given id(s). You can
|
||||
# either give multiple identifier separated by comma (,) or put this option
|
||||
|
@ -20,6 +20,9 @@ WORKDIR /app
|
||||
RUN apt-get update
|
||||
RUN apt-get install ffmpeg libsm6 libxext6 -y
|
||||
# -----------------------------------
|
||||
# if you will use gpu, then you should install tensorflow-gpu package
|
||||
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org tensorflow-gpu
|
||||
# -----------------------------------
|
||||
# install deepface from pypi release (might be out-of-the-date)
|
||||
# RUN pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host=files.pythonhosted.org deepface
|
||||
# -----------------------------------
|
||||
|
@ -62,10 +62,10 @@ def load_image(img):
|
||||
if type(img).__module__ == np.__name__:
|
||||
exact_image = True
|
||||
|
||||
elif len(img) > 11 and img[0:11] == "data:image/":
|
||||
elif img.startswith("data:image/"):
|
||||
base64_img = True
|
||||
|
||||
elif len(img) > 11 and img.startswith("http"):
|
||||
elif img.startswith("http"):
|
||||
url_img = True
|
||||
|
||||
# ---------------------------
|
||||
@ -177,9 +177,7 @@ def extract_faces(
|
||||
|
||||
if len(extracted_faces) == 0 and enforce_detection == True:
|
||||
raise ValueError(
|
||||
"Detected face shape is ",
|
||||
img.shape,
|
||||
". Consider to set enforce_detection argument to False.",
|
||||
f"Detected face shape is {img.shape}. Consider to set enforce_detection arg to False."
|
||||
)
|
||||
|
||||
return extracted_faces
|
||||
|
@ -87,12 +87,13 @@ def analysis(
|
||||
)
|
||||
faces = []
|
||||
for face_obj in face_objs:
|
||||
facial_area = face_obj["facial_area"]
|
||||
faces.append(
|
||||
(
|
||||
face_obj["facial_area"]["x"],
|
||||
face_obj["facial_area"]["y"],
|
||||
face_obj["facial_area"]["w"],
|
||||
face_obj["facial_area"]["h"],
|
||||
facial_area["x"],
|
||||
facial_area["y"],
|
||||
facial_area["w"],
|
||||
facial_area["h"],
|
||||
)
|
||||
)
|
||||
except: # to avoid exception if no face detected
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 515 KiB |
BIN
icon/stock-4.jpg
BIN
icon/stock-4.jpg
Binary file not shown.
Before Width: | Height: | Size: 255 KiB |
@ -93,7 +93,8 @@ def test_cases():
|
||||
assert "h" in objs[0]["facial_area"].keys()
|
||||
assert isinstance(objs[0]["embedding"], list)
|
||||
assert len(objs[0]["embedding"]) == 2622 # embedding of VGG-Face
|
||||
except:
|
||||
except Exception as err:
|
||||
print(str(err))
|
||||
exception_thrown = True
|
||||
|
||||
assert exception_thrown is False
|
||||
|
Loading…
x
Reference in New Issue
Block a user