simran0608 commited on
Commit
bc5e65b
·
verified ·
1 Parent(s): 3272532

Update drowsiness_detection.py

Browse files
Files changed (1) hide show
  1. drowsiness_detection.py +3 -3
drowsiness_detection.py CHANGED
@@ -44,7 +44,7 @@ HEAD_DOWN_COUNTER = 0 # Renaming for clarity
44
  head_down_alert = False
45
 
46
  # --- AUDIO SETUP (using Pygame) ---
47
- pygame.mixer.init()
48
  drowsiness_sound = pygame.mixer.Sound("drowsiness-detected.mp3")
49
  yawn_sound = pygame.mixer.Sound("yawning-detected.mp3")
50
  # head_down_sound = pygame.mixer.Sound("dependencies/audio/head-down-detected.mp3")
@@ -66,7 +66,7 @@ def generate_alert(final_eye_ratio, final_mouth_ratio):
66
  if not drowsy_alert:
67
  DROWSY_COUNTER += 1
68
  drowsy_alert = True
69
- Thread(target=play_alarm, args=(drowsiness_sound,)).start()
70
  else:
71
  EYE_THRESH_COUNTER = 0
72
  drowsy_alert = False
@@ -78,7 +78,7 @@ def generate_alert(final_eye_ratio, final_mouth_ratio):
78
  if not yawn_alert:
79
  YAWN_COUNTER += 1
80
  yawn_alert = True
81
- Thread(target=play_alarm, args=(yawn_sound,)).start()
82
  else:
83
  YAWN_THRESH_COUNTER = 0
84
  yawn_alert = False
 
44
  head_down_alert = False
45
 
46
  # --- AUDIO SETUP (using Pygame) ---
47
+ # pygame.mixer.init()
48
  drowsiness_sound = pygame.mixer.Sound("drowsiness-detected.mp3")
49
  yawn_sound = pygame.mixer.Sound("yawning-detected.mp3")
50
  # head_down_sound = pygame.mixer.Sound("dependencies/audio/head-down-detected.mp3")
 
66
  if not drowsy_alert:
67
  DROWSY_COUNTER += 1
68
  drowsy_alert = True
69
+ # Thread(target=play_alarm, args=(drowsiness_sound,)).start()
70
  else:
71
  EYE_THRESH_COUNTER = 0
72
  drowsy_alert = False
 
78
  if not yawn_alert:
79
  YAWN_COUNTER += 1
80
  yawn_alert = True
81
+ # Thread(target=play_alarm, args=(yawn_sound,)).start()
82
  else:
83
  YAWN_THRESH_COUNTER = 0
84
  yawn_alert = False