Cov txheej txheem:

Kev tsaug zog ceeb toom System: 3 Kauj Ruam
Kev tsaug zog ceeb toom System: 3 Kauj Ruam

Video: Kev tsaug zog ceeb toom System: 3 Kauj Ruam

Video: Kev tsaug zog ceeb toom System: 3 Kauj Ruam
Video: Tswv Yexus lub neej thaum pib txug thaum xaus 2024, Kaum ib hlis
Anonim
Kev tsaug zog ceeb toom System
Kev tsaug zog ceeb toom System

Txhua xyoo ntau tus neeg plam lawv txoj sia vim raug kev tuag hauv ntiaj teb thiab kev tsav tsheb tsis tsaug zog yog ib qho tseem ceeb ua rau muaj kev huam yuaj thiab tuag. Kev qaug zog thiab pw tsaug zog me me ntawm kev tswj hwm kev tsav tsheb feem ntau yog lub hauv paus ua rau muaj xwm txheej loj. Txawm li cas los xij, thawj cov cim ntawm kev qaug zog tuaj yeem kuaj pom ua ntej muaj xwm txheej tshwm sim thiab yog li ntawd, kuaj pom tus neeg tsav tsheb qaug zog thiab nws qhov kev qhia tseem tab tom tshawb fawb. Feem ntau ntawm cov txheej txheem ib txwm los txhawm rau pom kev tsaug zog yog ua raws kev coj tus cwj pwm thaum qee qhov cuam tshuam thiab tuaj yeem cuam tshuam rau cov tsav tsheb, thaum qee qhov xav tau cov ntsuas ntsuas siab. Yog li ntawd, hauv daim ntawv no, lub teeb yuag, lub sijhawm tiag tiag tus neeg tsav tsheb txoj kev tsaug zog pom tau tsim thiab ua haujlwm ntawm Android daim ntawv thov. Lub kaw lus kaw cov vis dis aus thiab pom tus neeg tsav tsheb lub ntsej muag hauv txhua lub thav duab los ntawm kev siv cov txheej txheem ua duab. Lub kaw lus muaj peev xwm txheeb xyuas thaj chaw thaj tsam ntawm lub ntsej muag, suav nrog Qhov Muag Pom Qhov Sib Piv (EAR) thiab Qhov Muag Kaw Qhov Muag (ECR) txhawm rau txheeb xyuas tus neeg tsav tsheb tsaug zog raws li qhov pib hloov pauv. Lub tshuab kev kawm algorithms tau ua haujlwm los ntsuas qhov ua tau zoo ntawm txoj kev thov. Cov txiaj ntsig ua piv txwv qhia pom tias tus qauv thov tuaj yeem ua tiav qhov tseeb ntawm 84% siv kev faib cais hav zoov.

Kauj Ruam 1: Yam Koj Xav Tau

1. RASPBERRY PI

2. WEBCAM (C270 HD WEB CAM RAU QHOV TSEEB)

Pc version yuav xav tau qee qhov kev hloov pauv hauv cov cai

Kauj Ruam 2: Python Code Nrog Qhov Muag Pom Cov Duab Ua Ntej Dataset (PC Version)

txhawm rau txheeb xyuas qhov muag tau zoo nyob rau lub sijhawm tiag tiag ntawm cov vis dis aus, peb tuaj yeem siv cov ntaub ntawv sbelow.dat no.

drive.google.com/open?id=1UiSHe72L4TeN14VK…

Rub tawm.dat cov ntaub ntawv los ntawm qhov txuas saum toj no thiab khiav cov lej hauv qab no

Nab hab sej code

from scipy.spatial import distancefrom imutils import face_utils import imutils import dlib import cv2

def eye_aspect_ratio (qhov muag):

A = distance.euclidean (qhov muag [1], qhov muag [5]) B = distance.euclidean (qhov muag [2], qhov muag [4]) C = nrug deb.euclidean (qhov muag [0], qhov muag [3]) pob ntseg = (A + B) / (2.0 * C) return ear thresh = 0.25 frame_check = 20 detect = dlib.get_frontal_face_detector () twv = dlib.shape_predictor (".

(lStart, lEnd) = face_utils. FACIAL_ SibS_68_IDXS ["left_eye"]

(rStart, rEnd) = face_utils. FACIAL_ SibS_68_IDXS ["right_eye"] cap = cv2. VideoCapture (0) chij = 0 thaum muaj tseeb: ret, thav duab = cap.read () thav duab = imutils.resize (thav duab, dav = 450) txho = cv2.cvtColor (thav duab, cv2. COLOR_BGR2GRAY) cov ntsiab lus = kuaj pom (txho, 0) rau cov ncauj lus hauv cov ncauj lus: duab = kwv yees (txho, txhoj puab) duab = ntsej muag_utils.shape_to_np (duab)#hloov mus rau NumPy Array leftEye = puab [lStart: lEnd] rightEye = shape [rStart: rEnd] leftEAR = eye_aspect_ratio (leftEye) rightEAR = eye_aspect_ratio (rightEye) pob ntseg = (leftEAR + rightEAR) / 2.0 leftEyeHull = cv2.convexHull (leftEye) rightEyeHull = cv2.convexHull drawContours (thav duab, [leftEyeHull], -1, (0, 255, 0), 1) cv2.drawContours (thav duab, [rightEyeHull], -1, (0, 255, 0), 1) yog pob ntseg = frame_check: cv2.putText (thav duab, "**************** ALERT! ****************", (10, 30), cv2. FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2) cv2.putText (thav duab, "**************** ALERT! *********** ***** ", (10, 325), cv2. FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2) #print (" Dro wsy ") lwm: chij = 0 cv2.imshow (" Ncej ", thav duab) qhov tseem ceeb = cv2.waitKey (1) & 0xFF yog qhov tseem ceeb == ord (" q "): so cv2.destroyAllWindows () cap.stop ()

Kauj ruam 3: Raspberry Pi Version

Qhov Raspberry Pi Version
Qhov Raspberry Pi Version
Qhov Raspberry Pi Version
Qhov Raspberry Pi Version

thaum cov tib neeg kaw nws lub qhov muag ces raspberry pi yuav ua rau koj ceeb toom

Txuas koj lub buzzer rau tus pin 23 (saib daim duab)

los ntawm scipy.spatial ntshuam nrug

ntshuam RPi. GPIO ua GPIO

los ntawm lub sijhawm ntshuam pw

GPIO.setwarnings (Cuav)

GPIO.setmode (GPIO. BCM)

los ntawm imutils ntshuam face_utils

import imutils import dlib import cv2

lub suab = 23

GPIO.setup (buzzer, GPIO. OUT)

def eye_aspect_ratio (qhov muag):

A = distance.euclidean (qhov muag [1], qhov muag [5]) B = distance.euclidean (qhov muag [2], qhov muag [4]) C = nrug deb.euclidean (qhov muag [0], qhov muag [3]) pob ntseg = (A + B) / (2.0 * C) return ear thresh = 0.25 frame_check = 20 detect = dlib.get_frontal_face_detector () twv = dlib.shape_predictor (".

(lStart, lEnd) = face_utils. FACIAL_ SibS_68_IDXS ["left_eye"]

(rStart, rEnd) = face_utils. FACIAL_ SibS_68_IDXS ["right_eye"] cap = cv2. VideoCapture (0) chij = 0 thaum muaj tseeb: ret, thav duab = cap.read () thav duab = imutils.resize (thav duab, dav = 450) txho = cv2.cvtColor (thav duab, cv2. COLOR_BGR2GRAY) cov ntsiab lus = kuaj pom (txho, 0) rau cov ncauj lus hauv cov ncauj lus: duab = kwv yees (txho, txhoj puab) duab = ntsej muag_utils.shape_to_np (duab)#hloov mus rau NumPy Array leftEye = puab [lStart: lEnd] rightEye = shape [rStart: rEnd] leftEAR = eye_aspect_ratio (leftEye) rightEAR = eye_aspect_ratio (rightEye) pob ntseg = (leftEAR + rightEAR) / 2.0 leftEyeHull = cv2.convexHull (leftEye) rightEyeHull = cv2.convexHull drawContours (thav duab, [leftEyeHull], -1, (0, 255, 0), 1) cv2.drawContours (thav duab, [rightEyeHull], -1, (0, 255, 0), 1) yog pob ntseg = frame_check: cv2.putText (thav duab, "**************** ALERT! ****************", (10, 30), cv2. FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2) cv2.putText (thav duab, "**************** ALERT! *********** ***** ", (10, 325), cv2. FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2) #print (" Dro uas ")

GPIO.output (buzzer, GPIO. HIGH)

lwm: chij = 0

GPIO.output (buzzer, GPIO. LOW)

cv2.imshow ("Frame", frame) key = cv2.waitKey (1) & 0xFF yog qhov tseem ceeb == ord ("q"): so cv2.destroyAllWindows () cap.stop ()

Pom zoo: