mirror of
https://github.com/serengil/deepface.git
synced 2025-06-06 11:35:21 +00:00
Merge branch 'analyze_raise_on_empty_actions' into YOLOv8
This commit is contained in:
commit
052abd26c7
@ -237,7 +237,7 @@ def analyze(
|
||||
):
|
||||
|
||||
"""
|
||||
This function analyzes facial attributes including age, gender, emotion and race.
|
||||
This function analyses facial attributes including age, gender, emotion and race.
|
||||
In the background, analysis function builds convolutional neural network models to
|
||||
classify age, gender, emotion and race of the input image.
|
||||
|
||||
@ -300,6 +300,18 @@ def analyze(
|
||||
actions = (actions,)
|
||||
|
||||
actions = list(actions)
|
||||
|
||||
# Check if actions have been passed correctly
|
||||
if not actions:
|
||||
raise ValueError("`actions` must be a list of strings.")
|
||||
|
||||
# For each action, check if it is valid
|
||||
for action in actions:
|
||||
if action not in ("emotion", "age", "gender", "race"):
|
||||
raise ValueError(
|
||||
f"Invalid action passed ({action})). "
|
||||
"Valid actions are `emotion`, `age`, `gender`, `race`."
|
||||
)
|
||||
# ---------------------------------
|
||||
# build models
|
||||
models = {}
|
||||
@ -728,7 +740,7 @@ def stream(
|
||||
|
||||
source: Set this to 0 for access web cam. Otherwise, pass exact video path.
|
||||
|
||||
time_threshold (int): how many second analyzed image will be displayed
|
||||
time_threshold (int): how many second analysed image will be displayed
|
||||
|
||||
frame_threshold (int): how many frames required to focus on face
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user