Skip to content

Commit

Permalink
Merge branch 'analyze_raise_on_empty_actions' into YOLOv8
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent-Stragier committed Jun 9, 2023
2 parents 08988fc + e845c00 commit 052abd2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions deepface/DeepFace.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 = {}
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 052abd2

Please sign in to comment.