Skip to content

An Integration of Amazon Rekognition and Flutter for Tracking Drivers’ Eyes to Prevent them from Sleeping.

License

Notifications You must be signed in to change notification settings

mahmoudai1/No-Sleep

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

No Sleep

• An Integration of Amazon Rekognition and Flutter for Tracking Drivers’ Eyes.
• It detects drivers’ eyes as if they slept while driving, a sound and vibration will start to play until he wakes up.

How it works:

• The Application lets the device’s camera capture an image each few seconds and save it locally in the device, sending this image’s bytes to Rekognition’s API, and then I get the response as a JSON file. If the Confidence for that a Face is included in the image more than 98, and the Value for the EyesOpen is False, then an alert will start to play and vibration will happen. Then, the image will be deleted from the device to prevent huge storage usage. Once the driver has opened his eyes, the sound and vibration will stop automatically. This process happens whenever the Application is opened. The Application uses Wakelock Package to prevent the device from sleeping.

Note: A delay may happen when the driver wakes up and the sound/vibration waits a few seconds to stop, for that case, I have implemented that if the driver touched the Application anywhere, any sound/vibration will be force stopped.

Performance/Monitoring:

Performance measured by using Flutter DevTools (Flutter run -- profile)

• Network/Requests:

Network

• Memory:

Memory

• Logs:

Logs

Application Architecture:

Architecture

Flutter Packages used:

• Camera • Wakelock • http • async • audioplayers • vibration

Real Life Testing:

• Drivers have to buy a Mobile Phone holder to embed it in the Car Steering Wheel. It costs 31EGP ≅ $2. I already bought one from souq.com to test the Application. A link and a picture of the product are attached below.

https://egypt.souq.com/eg-en/functional-mobile-phone-holder-mount-clip-buckle-socket-hands-free-on-car-steering-wheel-7536478/i/

https://www.amazon.com/Mobile-Holder-Steering-Samsung-Cellphones/dp/B06XXQ6B3M/ref=sr_1_6?dchild=1&keywords=steering+wheel+mobile+holder&qid=1624660622&sr=8-6

Mobile Phone Holder for Steering Wheel

*Discussions:

• A better idea to implement this application is to try to embed a built-in camera in the steering wheel itself instead of the Mobile holder, this requires the acceptance of the car’s company. If the company accepted, a new feature may be added is to let the car itself flash if the driver slept, so that any nearby car knows that this car’s driver is sleeping.

• People may need to add their custom sounds to play, may consider it in the next version.

• It would be better to connect to the car’s audio, so when the sound starts to play, the volume will be high enough to wake the driver up.

• I may let the application works on background in the next versions.

• The camera is hidden and not previewed on the screen to avoid distracting the driver “Seeing himself”.

• I used the front camera instead of the rear one as the front one’s images’ size is smaller than the rear one, so the process of uploading the image to Rekognition API won’t take time to finish.

• The Free Tier for Amazon Rekognition allows 5000 images per month which is 166 images per day, 7 per hour, image per 8.5 minutes. Thus, results may not be accurate. So, a better way is to subscribe to this service, which costs $0.001 per image for the first 1 million images processed per month.

• May use ImageStreaming technique rather than capture an image every few seconds.

Known Issues:

• If the driver is wearing a glass, Rekognition will always detect his eyes as open even if they are closed.

Screenshot of the Application:

Screenshot of the Application

Advices to do:

Low Power Mode: To reduce Battery Usage, as the Application may work for hours.

Do not disturb Mode: To avoid distraction while driving. Ex: Notifications.

Internet: To send a request to Rekognition API and receive the response (JSON).

Highest Volume: To listen to the sound well when it plays (Better if connects with Cars’ Audio).

Lowest Brightness: To reduce Battery Usage.

Application Logo:

Application Logo

Contact:

mahmoud.ahmed48@msa.edu.eg

About

An Integration of Amazon Rekognition and Flutter for Tracking Drivers’ Eyes to Prevent them from Sleeping.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published