飞机上的氧气面罩有什么用

This article is part of a series where I will be documenting my journey on the development of a social distancing feedback system for the blind as part of the OpenCV Spatial Competition. Check out the full series: Part 1, Part 2.

本文是系列文章的一部分,在该系列文章中,我将记录我在OpenCV空间竞赛中为盲人开发社交疏散反馈系统的过程。 查看完整的系列文章: 第1 部分 第2部分

为什么要选择面罩? (Why Face Mask Detection?)

As mentioned in Part 1 of the series, the objective of this project is to develop a feedback system for the blind to help them maintain the social distance with the people around using the OAK-D (by the way, congratulations to Luxonis LLC and Satya Mallick for the successful Kickstarter campaign!). In this article, I will focus on the detection of the people around using Deep Learning models in order to keep the distance to those people.

如该系列的第1部分所述,该项目的目的是为盲人开发一个反馈系统,以帮助他们使用OAK-D保持与周围人的社交距离 (顺便恭喜, Luxonis LLC和Satya Mallick为成功的Kickstarter广告系列! )。 在本文中,我将重点介绍使用深度学习模型对周围的人进行检测,以使其与这些人保持距离。

The detection of the people around the user could be done in multiple ways, one option could be to train a model for pedestrian detection as in this repository. Another possible option could be to detect only faces instead of detecting the whole body. The benefit of face detection models is that due to the unique features of faces, it is easier to detect faces even without the need of Deep Learning models. For example, in this OpenCV tutorial a Haar feature-based cascade classifiers method is used to detect faces in real time even in low computation devices.

可以通过多种方式对用户周围的人进行检测,一种选择可以是像在该存储库中那样为行人检测训练模型。 另一个可能的选择是仅检测面部而不是检测整个身体。 人脸检测模型的优势在于,由于人脸的独特功能,即使不需要深度学习模型,也更易于检测人脸。 例如,在此OpenCV教程中 基于Haar特征的级联分类器方法甚至可以在低计算设备中实时检测人脸。

However, in this particular application, we also want to know whether the people around are wearing face mask or not. Then, the best option will be to use only one model that detect where the people are and if they are using face mask, i.e. a face mask detector.

但是,在此特定应用程序中,我们还想知道周围的人是否戴着口罩。 然后,最好的选择是仅使用一种模型来检测人员所在的位置以及是否使用了面罩,即面罩检测器。

面罩检测器过多 (Overabundance of Face Mask Detectors)

Due to the increased use of face masks in the current pandemic, a high number of people have develop systems for face mask detection. A quick search in Github for “face mask detection” returns around 700 repositories on the topic. Similarly, a search for the same term in Youtube returns an endless list of videos showing the implementation of face detection models.

由于当前大流行中越来越多地使用面罩,因此许多人已经开发出用于面罩检测的系统。 在Github中快速搜索“面罩检测”将返回大约700个关于该主题的存储库。 同样, 在Youtube中搜索同一词会返回无尽的视频列表,这些视频显示了人脸检测模型的实现。

So, with such a high number of available examples, I expected that it should be quite easy to find an example that is fast enough for the OpenCV AI Kit with Depth (OAK-D) and that has good accuracy even in real life environments.

因此,由于有大量可用示例,我希望找到一个足够快的带深度OpenCV AI套件 ( OAK-D )且即使在现实环境中也具有良好准确性的示例应该非常容易。

However, which face mask detection example should we choose?

但是, 我们应该选择哪个面罩检测示例?

First, I decided to look at the top starred face mask detection repositories in Github. In the table below, a list of datasets and models used in some of those repositories are summarized.

首先,我决定查看Github最受关注的加星标口罩检测存储库 在下表中,汇总了其中一些存储库中使用的数据集和模型的列表。

As it can be observed, there are two main ways to perform face mask detection: 1. Face detection + face mask classification on each detected face or 2. Directly perform face mask detection. The first method could have better accuracy because already available face detection models have been trained in thousands of face images. In comparison, as ashown in the table, the face mask detection datasets have fewer images for training, where the AIZOOTech dataset has the higher number of images.

可以看出,有两种主要的方法来执行面罩检测: 1.面部检测+在每个检测到的面部上进行面罩分类2.直接执行面罩检测 。 第一种方法可能具有更好的准确性,因为已经在数千张面部图像中训练了已有的面部检测模型。 相比之下,如表中所示,面罩检测数据集具有较少的训练图像,其中AIZOOTech数据集具有较高的图像数目。

However, most of previous face detection models are trained on faces that were not covered in most of the cases. For this reason, in cases where the face is covered with a mask, the face detection model could miss the detection of the faces (as explained in the very well detailed article in pyimagesearch.com).

但是,大多数以前的面部检测模型都是针对大多数情况下未涵盖的面部进行训练的。 因此,在人脸被面具覆盖的情况下,人脸检测模型可能会错过人脸的检测(如pyimagesearch.com中非常详细的文章所述 )。

使用OAK-D进行口罩检测 (Face mask detection using OAK-D)

Before analyzing the previously mentioned examples, the people at Luxonis already provide a demo for face mask detection using the OAK-D. The model in the demo is a MobileNetV2 (SSD) trained in Google Colab.

在分析前面提到的示例之前, Luxonis的人员已经提供了使用OAK-D进行面罩检测演示 。 该演示中的模型是经过Google Colab培训MobileNetV2(SSD)。

Note: Even though it is not included in the demo, they also provide another Google Colab script for training a YOLOv3-tiny model for face mask detection.

注意:尽管演示中未包含该工具,但他们还提供了另一个Google Colab脚本,用于训练YOLOv3-tiny模型以检测面罩

To run the demo, it is necessary to install the DepthAI Python module. As mentioned in Part 1, the Windows version is still experimental. However, recently the process has been updated so that it is much easier to install the library following the steps in the last comment in the Luxonis Dicussion.

要运行该演示,必须安装DepthAI Python模块。 如第1部分所述,Windows版本仍处于试验阶段。 但是,最近该过程已更新,因此按照Luxonis Dicussion中 最后一个注释中 步骤安装该库要容易得多。

However, as of today, the face mask detection demo is configured to work with an older version of the DepthAI library. So, I modified the demo to work with the current version of DepthAI and can be found in my Github repository for this project. To run the demo, it is necessary to install the DepthAI library as explained before and add the depthai folder to the PYTHONPATH of your system. Next open the command and run the following commands:

但是,截至今天,面罩检测演示已配置为可与DepthAI库的旧版本一起使用。 因此,我修改了演示以与DepthAI的当前版本一起使用 ,可以在我的 这个项目的Github仓库 要运行该演示,必须按照前面的说明安装DepthAI库,并将depthai文件夹添加到系统的PYTHONPATH中。 接下来打开命令并运行以下命令:

git clone https://github.com/ibaiGorordo/Social-Distance-Feedback.gitcd "Social-Distance-Feedback\Part 2 - Mask Detection"python demo_mask_detector.py

The demo_mask_detector.py is a script that configures the OAK-D to perform face mask detection on RGB camera and shows the image and detection from the OAK-D.

demo_mask_detector.py是一个脚本,该脚本将OAK-D配置为在RGB相机上执行面部遮罩检测,并显示图像和来自OAK-D的检测。

import numpy as np
import cv2
from demo_helpers import config, capture_image, get_detection, calculate_frame_speed, decode_mobilenet_ssd, show_mobilenet_ssd
from time import time, sleep, monotonic
import os
import depthai
print('Using depthai module from: ', depthai.__file__)# Create a list of enabled streams ()
stream_names = ['metaout', 'previewout']device = depthai.Device('', False)# create the pipeline, here is the first connection with the device
p = device.create_pipeline(config=config)if p is None:print('Pipeline is not created.')exit(3)while True:# retreive data from the device# data is stored in packets, there are nnet (Neural NETwork) packets which have additional functions for NNet result interpretationnnet_packets, data_packets = p.get_available_nnet_and_data_packets(True)ret, frame = capture_image(data_packets)nnet_prev = get_detection(nnet_packets)if ret:frame_count = calculate_frame_speed()nn_frame = show_mobilenet_ssd(nnet_prev["entries_prev"]['rgb'], frame, is_depth=0)cv2.putText(nn_frame, "fps: " + str(frame_count), (25, 50), cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0, 0, 0))cv2.imshow("Mask detection", nn_frame)key = cv2.waitKey(1)if key == ord('q'):breakdel p  # in order to stop the pipeline object should be deleted, otherwise device will continue working. This is required if you are going to add code after the main loop, otherwise you can ommit it.
device.deinit_device()
print('py: DONE.')

The video below shows the inference output from the OAK-D for the MobileNetV2 (SSD) face mask detection model (trained using DepthAI’s Google Colab script).

以下视频显示了OAK-D对MobileNetV2(SSD) 面罩检测模型的推理输出(使用DepthAI的Google Colab密码进行了训练)。

Face Mask Detection using the OAK-D (SSD-MobileNetV2)
使用OAK-D(SSD-MobileNetV2)进行面罩检测

面罩检测模型在野外如何表现? (How do face mask detection models behave in the wild?)

The previous example is similar to the many tutorials that end up with an example of the inference using the webcam. However, the objective of my system is to be used in daily life, particularly outdoors. Therefore, the system should be robust in different light conditions and even when there are multiple people around.

前面的示例与许多教程相似,最后以使用网络摄像头进行推理为例。 但是,我系统的目标是在日常生活中,尤其是在户外使用。 因此,即使在周围有多个人的情况下,该系统也应在不同的光照条件下都非常坚固。

For that reason, I decided to see how different face mask detection models behaved in a more realistic environment. For that purpose, I used this public video from pexels.com of people walking in a night market. The video below shows a comparison of the face mask detection for the SSD-MobileNetV2 Vs. the YOLOv3-tiny models trained using DepthAI’s Google Colab scripts. The code for the inference program can be found in my Github repository here.

因此,我决定看看在更现实的环境中不同的面罩检测模型如何表现。 为此,我使用了来自pexels.com的公开视频,内容是在夜市里散步的人们 。 以下视频比较了SSD-MobileNetV2 Vs的面罩检测。 使用DepthAI的Google Colab脚本训练的YOLOv3-tiny模型。 推理程序的代码可以在我的Github存储库中找到

演示地址

Comparison of face mask detection in a real life environment using the SSD-MobileNetV2 and YOLOv3-tiny models
使用SSD-MobileNetV2和YOLOv3-tiny模型在现实生活环境中进行面罩检测的比较

As it can be observed, the SSD-MobilenetV2 model had a higher number of detections but as a result, a higher number of those detections were wrong detections. Even increasing the confidence threshold to 0.7 (as in the video above), the SSD-MobilenetV2 model still had a high number of false detections.

可以观察到, SSD-MobilenetV2模型具有较高的检测数量,但结果是,这些检测中的较高数量是错误检测。 即使将置信度阈值提高到0.7(如上面的视频中所示), SSD-MobilenetV2模型仍然存在大量错误检测。

On the other hand, the YOLOv3-tiny model missed some of the faces (particularly the faces that were far away) but had a more stable detections with a confidence threshold of 0.5. Since our application only needs to detect people that are close to the user (at a distance of 3 meters or closer), the YOLOv3-tiny model seems to be the most promising model of the two.

另一方面, YOLOv3-tiny模型遗漏了一些面部(尤其是距离较远的面部),但是检测更为稳定,置信度阈值为0.5。 由于我们的应用程序仅需要检测靠近用户(3米或更近的距离)的人员,因此YOLOv3-tiny模型似乎是两者中最有希望的模型。

YOLOv4呢? (What about YOLOv4?)

Recently, Alexey Bochkovskiy presented a new YOLO version (YOLOv4) which provides higher performance than the previous versions. In the video below, there is an example from Mladen Zamanov where it can be seen that YOLOv4 can perform face mask detection even with many people around.

最近,Alexey Bochkovskiy提出了 YOLO新版本(YOLOv4) 比以前的版本提供更高的性能。 在下面的视频中,有一个来自Mladen Zamanov的示例,可以看出YOLOv4即使在周围很多人的情况下也可以执行面部遮罩检测。

演示地址

Mladen ZamanovMladen Zamanov的YOLOv4面罩检测推断

The problem of using YOLOv4 in our application is that in order to pass the model to the OAK-D, the model needs to be converted to a .blob file to be run by the Myriad X inside the OAK-D. However, in order to convert the model, it is necessary to use OpenVINO toolkit’s model optimizer which currently officially supports until YOLOv3.

在我们的应用程序中使用YOLOv4的问题是,为了将模型传递给OAK-D ,需要将模型转换为.blob文件 ,以由OAK-D内部的Myriad X运行。 但是,为了转换模型,必须使用OpenVINO工具箱的模型优化器 ,该模型优化器目前在YOLOv3之前一直官方支持。

Even though that thanks to the repository by TNTWEN it is possible to use the model optimizer with the latest OpenVINO (2020.4) version, the depthAI module still does not support it. As a result, as of today, it seems that YOLOv4 cannot be used in the OAK-D with the built-in cameras.

即使由于TNTWEN存储库,仍可以将模型优化器与最新的OpenVINO(2020.4)版本一起使用depthAI模块仍不支持它。 结果,从今天开始,似乎YOLOv4无法在内置相机的OAK-D中使用。

Anyway, I decided to give a try to YOLOv4 in case in a near future it becomes available for the OAK-D. Particularly, I focused on the new YOLOv4-tiny version because it should be more suitable for real time inference in devices with lower computation power (actually the author of YOLOv4 has been able to run a modified version of the full YOLOv4 in the same chip inside the OAK-D as shown here).

无论如何,我决定尝试一下YOLOv4 ,以防它在不久的将来可用于OAK-D 。 特别是,我专注于新版YOLOv4-tiny版本,因为它应该更适合于具有较低计算能力的设备中的实时推断(实际上YOLOv4的作者已经能够在同一芯片内部运行完整YOLOv4的修改版) OAK-D ,如此处所示 )。

For that purpose, I trained the YOLOv4-tiny model in Google Colab using this script (code below), which was based on DepthAI’s original script. In the same script, I also added the code to detect face masks on the same video I used to compare SSD-MobileNetV2 with YOLOv3.

为此,我使用了该脚本 (以下代码)Google Colab中训练了YOLOv4-tiny模型, 该脚本基于DepthAI的原始脚本。 在同一脚本中,我还添加了用于检测同一视频的面罩的代码,该视频用于比较SSD-MobileNetV2YOLOv3

In the video below, I show the comparison of the results for YOLOv3-tiny Vs. YOLOv4-tiny for face mask detection.

在下面的视频中,我显示了YOLOv3-tiny Vs结果的比较。 YOLOv4-tiny用于面罩检测

演示地址

Comparison of face mask detection in a real life environment using the YOLOv4-tiny and YOLOv3-tiny models
使用YOLOv4-tiny和YOLOv3-tiny模型在现实环境中检测口罩的比较

As it can be observed, the results very similar between both models. In some cases, YOLOv4-tiny is capable of detecting faces that YOLOv3-tiny is not capable, but overall the results are almost identical.

可以看出,两个模型之间的结果非常相似。 在某些情况下, YOLOv4-tiny能够检测到YOLOv3-tiny无法检测到的面部,但是总体结果几乎是相同的。

In summary, I will probably continue using YOLOv3-tiny for face mask detection unless new support becomes available for YOLOv4. In the next part, I will focus on the combination of depth and object detection data.

总之,除非可以为YOLOv4提供新的支持,否则我可能会继续使用YOLOv3-tiny进行面罩检测。 在下一部分中,我将重点介绍深度和对象检测数据的组合。

All the code from this part and for the next part can be found in my following repository: https://github.com/ibaiGorordo/Social-Distance-Feedback.

该部分以及下一部分的所有代码都可以在我的以下存储库中找到: https : //github.com/ibaiGorordo/Social-Distance-Feedback 。

翻译自: https://towardsdatascience.com/part-2-yet-another-face-mask-detector-opencv-spatial-ai-competition-journey-91dfaf96c6e8

飞机上的氧气面罩有什么用


http://www.taodudu.cc/news/show-997534.html

相关文章:

  • 数字经济的核心是对大数据_大数据崛起为数字世界的核心润滑剂
  • azure第一个月_MLOps:两个Azure管道的故事
  • 编译原理 数据流方程_数据科学中最可悲的方程式
  • 解决朋友圈压缩_朋友中最有趣的朋友[已解决]
  • pymc3 贝叶斯线性回归_使用PyMC3进行贝叶斯媒体混合建模,带来乐趣和收益
  • ols线性回归_普通最小二乘[OLS]方法使用于机器学习的简单线性回归变得容易
  • Amazon Personalize:帮助释放精益数字业务的高级推荐解决方案的功能
  • 西雅图治安_数据科学家对西雅图住宿业务的分析
  • 创意产品 分析_使用联合分析来发展创意
  • 多层感知机 深度神经网络_使用深度神经网络和合同感知损失的能源产量预测...
  • 使用Matplotlib Numpy Pandas构想泰坦尼克号高潮
  • pca数学推导_PCA背后的统计和数学概念
  • 鼠标移动到ul图片会摆动_我们可以从摆动时序分析中学到的三件事
  • 神经网络 卷积神经网络_如何愚弄神经网络?
  • 如何在Pandas中使用Excel文件
  • tableau使用_使用Tableau升级Kaplan-Meier曲线
  • numpy 线性代数_数据科学家的线性代数—用NumPy解释
  • 数据eda_银行数据EDA:逐步
  • Bigmart数据集销售预测
  • dt决策树_决策树:构建DT的分步方法
  • 已知两点坐标拾取怎么操作_已知的操作员学习-第3部分
  • 特征工程之特征选择_特征工程与特征选择
  • 熊猫tv新功能介绍_熊猫简单介绍
  • matlab界area_Matlab的数据科学界
  • hdf5文件和csv的区别_使用HDF5文件并创建CSV文件
  • 机器学习常用模型:决策树_fairmodels:让我们与有偏见的机器学习模型作斗争
  • 100米队伍,从队伍后到前_我们的队伍
  • mongodb数据可视化_使用MongoDB实时可视化开放数据
  • Python:在Pandas数据框中查找缺失值
  • Tableau Desktop认证:为什么要关心以及如何通过

飞机上的氧气面罩有什么用_第2部分—另一个面罩检测器……(相关推荐

  1. 某空姐写的飞机上名人印象

    安在旭:瘦瘦小小的,而且是黑瘦黑瘦的,其貌不扬,没有太多表情,和我们在电视上看到的完全是两回事(感叹化妆师的技术).我们航班上的男空乘看到他后顿时自信了很多,一改往日碰到帅哥明星一脸沮丧的样子,一个一 ...

  2. 飞机上一般是什么操作系统?

    (给视学算法加星标,修炼编程内功) 来源:CU技术社区 前一段时间,波音737MAX空难失事事件牵动人心,让人对航空出行又平添了一份不信任,根据最新消息显示,美国联邦航空局对737 MAX机型的大量评 ...

  3. 教授在飞机上做微积分,被当作恐怖分子抓了......

    来自宾夕法尼亚大学经济系的副教授Guido Menzio遭遇了一件令其感到非常无可奈何的一件事情.据<华盛顿邮报>报道,Menzio坐上3950航班等待飞机起飞,坐在他旁边的女性想要跟Me ...

  4. 飞机上为啥禁止使用手机?

    美国德尔塔航空公司乘客在从新泽西飞往佛罗里达的航班上无意间拍下了美国"奋进号"航天飞机升空的一幕,受到网友强烈追捧.据报道,33岁的斯蒂芬妮(Stefanie Gordon)在拍摄 ...

  5. 小龙虾上天了!口碑APP推出飞机上扫码点餐服务

    大家都知道,今年年初中国多家航空公司宣布飞机上可以玩手机了: 看到这条新闻很多"飞行族"跃跃欲试,怎么在解禁初期抢先装逼一把,比如这种"被迫"自拍的: 然鹅,虽 ...

  6. 蚂蚁从飞机上掉下来的数学建模分析

    原文链接:蚂蚁从飞机上掉下来会摔死吗?[微信公众号:数学建模andMATLAB] 蚂蚁从飞机上掉下来会摔死吗?为什么会想到这个问题呢?这还得从杜甫的一首诗说起.....               独 ...

  7. 空难生还几率这么低,飞机上为什么不配备降落伞???

    每一次飞机失事 你是不是都会想 如果飞机在设计的时候装上跳伞 在坠机的千钧一发来一个优雅的跳伞 这要挽救多少人的性命啊 >>>> ▼ 其实当初我也多次这么想过 来来来  搬好小 ...

  8. 黑匣子解密要多久_科普|飞机上的黑匣子内置电池可工作多久?

    我们大多数人都知道在飞机上有一个"黑匣子",那你了解黑匣子吗?你知道它内置电池可工作多久吗? 1 "黑匣子"到底是什么东西? "黑匣子"是飞 ...

  9. xml可以打包成jar吗_国内飞机上可以带化妆品吗 坐飞机怎么打包化妆品

    护肤品和化妆品已经成为大多数女性每日都会使用的物品,因此出去外地旅行或工作也是需要带上的.而飞机也是人们外出经常会选择的工具之一,那么国内飞机上可以带化妆品吗?坐飞机怎么打包化妆品呢?来看看! 国内飞 ...

最新文章

  1. 如何在SAP云平台上使用MongoDB服务
  2. 三天学会Selenium,阿里p7精心整理自动化测试Selenium大礼包
  3. 【OO学习】OO第四单元作业总结及OO课程总结
  4. 如何编译 php,如何编译安装一个php模块
  5. iOS tabview 适配问题
  6. IOS UILabel组件
  7. Python多线程与Socket编程综合案例:素数
  8. Could not load dynamic library ‘libcudart.so.10.0‘; dlerror: libcudart.so.10.0: cannot open shared o
  9. 基于神念TGAM的脑波小车(4)
  10. Python实现基于VGG16迁移学习实现手写数字识别
  11. 如何在电脑上实现企业微信多开?
  12. 新MacBookAir (M1 2020)修改开机启登录密码
  13. c++实现远程开关机
  14. android app整包更新,uniapp热更新和整包更新
  15. java小组的队名,霸气小组队名口号大全
  16. 2021年南京邮电大学自动化学院、人工智能学院考研指南
  17. Android图片压缩库——libjpeg-turbo
  18. 12306从上海到湖南境内的终点站车次或从湖南境内始发到上海的车次
  19. 如何创建内容安全策略(CSP 标头)
  20. 【计算机科学与技术】信息论笔记:合集

热门文章

  1. [LoadRunner]UTF8字符格式
  2. Linux 查看磁盘或文件夹及文件大小
  3. 2007年淘宝网手机销量统计报告
  4. InstallShield For .Net制作.Net项目安装包之完整代码
  5. docker 安装 oracle 11g
  6. Spring Boot集成Druid监控
  7. WebM VP8 SDK Usage/关于WebM VP8 SDK的用法
  8. 使用Kubespray部署生产可用的Kubernetes集群(1.11.2)
  9. Mysql5.7开启远程
  10. webservice 基本要点