Skip to content

Commit

Permalink
Fix index out bounds
Browse files Browse the repository at this point in the history
  • Loading branch information
SarapaloFuturice committed Sep 22, 2019
1 parent 74eadbf commit 238b079
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions drowsiness_detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ def get_next_image(image_name):
def get_final_drowsiness_level(drowsiness_counts):
l = lambda key: drowsiness_counts[key] >= EYE_ASPECT_RATIO_REQUIRED_FRAMES
filtered = list(filter(l, drowsiness_counts.keys()))
print(filtered)
return drowsiness_to_number(filtered[0])
return drowsiness_to_number(filtered[0]) if len(filtered) > 0 else 0

def drowsiness_to_number(drowsiness):
return {
Expand Down

0 comments on commit 238b079

Please sign in to comment.