【推荐】树莓派/OpenCV/dlib人脸定位/瞌睡检测

2017 年 10 月 24 日 机器学习研究会


点击上方 “机器学习研究会”可以订阅
摘要
 

转自:爱可可-爱生活

Today’s blog post is the long-awaited tutorial on real-time drowsiness detection on the Raspberry Pi!


Back in May I wrote a (laptop-based) drowsiness detector that can be used to detect if the driver of a motor vehicle was getting tired and potentially falling asleep at the wheel.


The driver drowsiness detector project was inspired by a conversation I had with my Uncle John, a long haul truck driver who has witnessed a more than a few accidents due to fatigued drivers.

The post was really popular and a lot of readers got value out of it…


…but the method was not optimized for the Raspberry Pi!

Since then readers have been requesting me to write a followup blog post that covers the necessary optimizations to run the drowsiness detector on the Raspberry Pi.


I caught up with my Uncle John a few weeks ago and asked him what he would think of a small computer that could be mounted inside his truck cab to help determine if he was getting tired at the wheel.


He wasn’t crazy about the idea of being monitored by a camera his entire work day (and I don’t necessarily blame him either — I wouldn’t want to be monitored all the time either). But he dideventually concede that a device like this, and ideally less invasive, would certainly help avoid accidents due to fatigued drivers.


To learn more about these facial landmark optimizations and how to run our drowsiness detector on the Raspberry Pi, just keep reading!


Raspberry Pi: Facial landmarks + drowsiness detection with OpenCV and dlib


Today’s tutorial is broken into four parts:

  1. Discussing the tradeoffs between Haar cascades and HOG + Linear SVM detectors.

  2. Examining the TrafficHAT used to create the alarm that will sound if a driver/user gets tired.

  3. Implementing dlib facial landmark optimizations so we can deploy our drowsiness detector to the Raspberry Pi.

  4. Viewing the results of our optimized driver drowsiness detection algorithm on the Raspberry Pi.

Before we get started I would highly encourage you to read through my previous tutorial onDrowsiness detection with OpenCV.


While I’ll be reviewing the code in its entirety here, you should still read the previous post as I discuss the actual Eye Aspect Ratio (EAR) algorithm in more detail.


The EAR algorithm is responsible for detecting driver drowsiness.


Haar cascades: less accurate, but faster than HOG

The major optimization we need to run our driver drowsiness detection algorithm on the Raspberry Pi is to swap out the default dlib HOG + Linear SVM face detector and replace it with OpenCV’s Haar cascade face detector.

While HOG + Linear SVM detectors tend to be significantly more accurate than Haar cascades, the cascade method is also much faster than HOG + Linear SVM detection algorithms.


A complete review of both HOG + Linear SVM and Haar cascades work is outside the scope of this blog post, but I would encourage you to:

  1. Read this post on Histogram of Oriented Gradients and Object Detection where I discuss the pros and cons of HOG + Linear SVM and Haar cascades.

  2. Work through the PyImageSearch Gurus course where I demonstrate how to implement your own custom HOG + Linear SVM object detectors from scratch.

The Raspberry Pi TrafficHAT

In our previous tutorial on drowsiness detection I used my laptop to execute driver drowsiness detection code — this enabled me to:

  1. Ensure the drowsiness detection algorithm would run in real-time due to the faster hardware.

  2. Use the laptop speaker to sound an alarm by playing a .WAV file.


The Raspberry Pi does not have a speaker so we cannot play any loud alarms to wake up the driver…


…but the Raspberry Pi is a highly versatile piece of hardware that includes a large array of hardware add-ons.


链接:

https://www.pyimagesearch.com/2017/10/23/raspberry-pi-facial-landmarks-drowsiness-detection-with-opencv-and-dlib/


原文链接:

https://m.weibo.cn/1402400261/4166258624780220

“完整内容”请点击【阅读原文】
↓↓↓
登录查看更多
9

相关内容

一个跨平台的计算机视觉处理库,全称是Open Source Computer Vision。
专知会员服务
31+阅读 · 2020年4月24日
专知会员服务
109+阅读 · 2020年3月12日
开源书:PyTorch深度学习起步
专知会员服务
49+阅读 · 2019年10月11日
2019年机器学习框架回顾
专知会员服务
35+阅读 · 2019年10月11日
[综述]深度学习下的场景文本检测与识别
专知会员服务
77+阅读 · 2019年10月10日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
【推荐】(TensorFlow)SSD实时手部检测与追踪(附代码)
机器学习研究会
11+阅读 · 2017年12月5日
【推荐】直接未来预测:增强学习监督学习
机器学习研究会
6+阅读 · 2017年11月24日
【推荐】用Python/OpenCV实现增强现实
机器学习研究会
14+阅读 · 2017年11月16日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
【推荐】视频目标分割基础
机器学习研究会
9+阅读 · 2017年9月19日
【推荐】深度学习目标检测全面综述
机器学习研究会
21+阅读 · 2017年9月13日
【推荐】深度学习目标检测概览
机器学习研究会
10+阅读 · 2017年9月1日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
【推荐】TensorFlow手把手CNN实践指南
机器学习研究会
5+阅读 · 2017年8月17日
Anomalous Instance Detection in Deep Learning: A Survey
Clustered Object Detection in Aerial Images
Arxiv
5+阅读 · 2019年8月27日
Object Detection in 20 Years: A Survey
Arxiv
48+阅读 · 2019年5月13日
VIP会员
相关VIP内容
专知会员服务
31+阅读 · 2020年4月24日
专知会员服务
109+阅读 · 2020年3月12日
开源书:PyTorch深度学习起步
专知会员服务
49+阅读 · 2019年10月11日
2019年机器学习框架回顾
专知会员服务
35+阅读 · 2019年10月11日
[综述]深度学习下的场景文本检测与识别
专知会员服务
77+阅读 · 2019年10月10日
机器学习入门的经验与建议
专知会员服务
90+阅读 · 2019年10月10日
相关资讯
【推荐】(TensorFlow)SSD实时手部检测与追踪(附代码)
机器学习研究会
11+阅读 · 2017年12月5日
【推荐】直接未来预测:增强学习监督学习
机器学习研究会
6+阅读 · 2017年11月24日
【推荐】用Python/OpenCV实现增强现实
机器学习研究会
14+阅读 · 2017年11月16日
【推荐】YOLO实时目标检测(6fps)
机器学习研究会
20+阅读 · 2017年11月5日
【推荐】视频目标分割基础
机器学习研究会
9+阅读 · 2017年9月19日
【推荐】深度学习目标检测全面综述
机器学习研究会
21+阅读 · 2017年9月13日
【推荐】深度学习目标检测概览
机器学习研究会
10+阅读 · 2017年9月1日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
【推荐】TensorFlow手把手CNN实践指南
机器学习研究会
5+阅读 · 2017年8月17日
Top
微信扫码咨询专知VIP会员