Toggle navigation
Toggle navigation
This project
Loading...
Sign in
skywrace
/
drowsiness_detector
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
skywrace
2022-05-14 22:41:05 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2c17ecc7fe22900c0ec8cbbd32f675d8b7de83f4
2c17ecc7
1 parent
4af57cc7
feat: Check able to detect mouth
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
0 deletions
DetectModel/main.py
DetectModel/pre_trained/haarcascade_mcs_mouth.xml
DetectModel/main.py
View file @
2c17ecc
...
...
@@ -10,6 +10,7 @@ import pygame
def
main
():
leye
=
cv2
.
CascadeClassifier
(
'pre_trained/haarcascade_lefteye_2splits.xml'
)
reye
=
cv2
.
CascadeClassifier
(
'pre_trained/haarcascade_righteye_2splits.xml'
)
mouth_class
=
cv2
.
CascadeClassifier
(
'pre_trained/haarcascade_mcs_mouth.xml'
)
model
=
load_model
(
'model/eyes_weight.h5'
)
pygame
.
mixer
.
init
()
warning_sound
=
pygame
.
mixer
.
Sound
(
'asset/windsheld.mp3'
)
...
...
@@ -47,9 +48,14 @@ def main():
L
,
gray
=
lr
.
light_removing
(
frame
)
left_eye
=
leye
.
detectMultiScale
(
gray
)
right_eye
=
reye
.
detectMultiScale
(
gray
)
mouth
=
mouth_class
.
detectMultiScale
(
gray
)
left_eye_open
=
get_eye_open
(
frame
,
left_eye
)
right_eye_open
=
get_eye_open
(
frame
,
right_eye
)
# print mouth bound
for
(
x
,
y
,
w
,
h
)
in
mouth
:
cv2
.
rectangle
(
frame
,
(
x
,
y
),
(
x
+
w
,
y
+
h
),
(
0
,
255
,
0
),
2
)
both_eyes_closed
=
False
if
left_eye_open
!=
None
or
right_eye_open
!=
None
:
both_eyes_closed
=
not
left_eye_open
and
not
right_eye_open
...
...
DetectModel/pre_trained/haarcascade_mcs_mouth.xml
0 → 100644
View file @
2c17ecc
This diff could not be displayed because it is too large.
Please
register
or
login
to post a comment