Update src/drowsiness_detection.py
Browse files
src/drowsiness_detection.py
CHANGED
@@ -13,11 +13,11 @@ import os
|
|
13 |
# --- INITIALIZE MODELS AND CONSTANTS ---
|
14 |
|
15 |
# Haar cascade classifier for face detection
|
16 |
-
haar_cascade_face_detector = "
|
17 |
face_detector = cv.CascadeClassifier(haar_cascade_face_detector)
|
18 |
|
19 |
# Dlib facial landmark detector
|
20 |
-
dlib_facial_landmark_predictor = "
|
21 |
landmark_predictor = dlib.shape_predictor(dlib_facial_landmark_predictor)
|
22 |
|
23 |
# Important Variables
|
@@ -45,8 +45,8 @@ head_down_alert = False
|
|
45 |
|
46 |
# --- AUDIO SETUP (using Pygame) ---
|
47 |
pygame.mixer.init()
|
48 |
-
drowsiness_sound = pygame.mixer.Sound("
|
49 |
-
yawn_sound = pygame.mixer.Sound("
|
50 |
# head_down_sound = pygame.mixer.Sound("dependencies/audio/head-down-detected.mp3")
|
51 |
|
52 |
# --- CORE FUNCTIONS ---
|
|
|
13 |
# --- INITIALIZE MODELS AND CONSTANTS ---
|
14 |
|
15 |
# Haar cascade classifier for face detection
|
16 |
+
haar_cascade_face_detector = "haarcascade_frontalface_default.xml"
|
17 |
face_detector = cv.CascadeClassifier(haar_cascade_face_detector)
|
18 |
|
19 |
# Dlib facial landmark detector
|
20 |
+
dlib_facial_landmark_predictor = "shape_predictor_68_face_landmarks.dat"
|
21 |
landmark_predictor = dlib.shape_predictor(dlib_facial_landmark_predictor)
|
22 |
|
23 |
# Important Variables
|
|
|
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")
|
51 |
|
52 |
# --- CORE FUNCTIONS ---
|