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

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

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.git
cd "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密码进行了训练)。

Image for post
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.mzph.cn/news/391814.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

经典网络流题目模板(P3376 + P2756 + P3381 : 最大流 + 二分图匹配 + 最小费用最大流)...

题目来源 P3376 【模板】网络最大流P2756 飞行员配对方案问题P3381 【模板】最小费用最大流最大流 最大流问题是网络流的经典类型之一,用处广泛,个人认为网络流问题最具特点的操作就是建反向边,这样相当于给了反悔的机会,不断地求…

数字经济的核心是对大数据_大数据崛起为数字世界的核心润滑剂

数字经济的核心是对大数据“Information is the oil of the 21st century, and analytics is the combustion engine”.“信息是21世纪的石油,分析是内燃机”。 — Peter Sondergaard, Senior Vice President of Gartner Research.— Gartner研究部高级副总裁Peter…

制作简单的WIFI干扰器

原教程链接:http://www.freebuf.com/geek/133161.htmlgithub 1.准备材料 制作需要的材料有 nodemcu开发版IIC通信 128*64 OLED液晶屏电线按钮开关万能板排针(自选)双面胶(自选)参考2.准备焊接 引脚焊接参考 oled按钮效果3.刷入固件 下载烧录工具:ESP8266Flasher.exe 下载固件:…

Snipaste截图

绘图绘色,描述加图片能更加说明问题的本质。今天推荐一款多功能的截图snipaste... 欣赏绘色 常见报错 解决方案: 下载相关的DLL即可解决, 请根据你操作系统的版本(32位/64位),下载并安装相应的微软 Visual …

azure第一个月_MLOps:两个Azure管道的故事

azure第一个月Luuk van der Velden and Rik Jongerius卢克范德费尔登(Luuk van der Velden)和里克 琼格里乌斯( Rik Jongerius) 目标 (Goal) MLOps seeks to deliver fresh and reliable AI products through continuous integration, continuous training and continuous del…

VS2008 开发设计MOSS工作流 URN 注意了

最近学习MOSS 很苦恼,进度也很慢,最近在学习VS2008开发工作流,其中有结合INFOPATH 2007来做, 出现个BUG或者说是设置的问题,整整花了我一天工作时间,是这样的: 在部署的时候关于URN,大部分的教程都是这样的说的&#…

ArangoDB Foxx service 使用

备注:项目使用的是github https://github.com/arangodb-foxx/demo-hello-foxx1. git clonegit clone https://github.com/arangodb-foxx/demo-hello-foxx.git 2. 安装foxx servicefoxx-manager install demo-hello-foxx /demoapp 3. 效果自动生成的swagger 文档项目…

编译原理 数据流方程_数据科学中最可悲的方程式

编译原理 数据流方程重点 (Top highlight)Prepare a box of tissues! I’m about to drop a truth bomb about statistics and data science that’ll bring tears to your eyes.准备一盒纸巾! 我将投放一本关于统计和数据科学的真相炸弹,这会让您眼泪汪…

iOS-FMDB

2019独角兽企业重金招聘Python工程师标准>>> #import <Foundation/Foundation.h> #import <FMDatabase.h> #import "MyModel.h"interface FMDBManager : NSObject {FMDatabase *_dataBase; }(instancetype)shareInstance;- (BOOL)insert:(MyM…

解决朋友圈压缩_朋友中最有趣的朋友[已解决]

解决朋友圈压缩We live in uncertain times.我们生活在不确定的时代。 We don’t know when we’re going back to school or the office. We don’t know when we’ll be able to sit inside at a restaurant. We don’t even know when we’ll be able to mosh at a Korn co…

MapServer应用开发平台示例

MapServer为当前开源WebGIS的应用代表&#xff0c;在西方社会应用面极为广泛&#xff0c;现介绍几个基于它的开源应用平台。 1.GeoMOOSE GeoMoose is a Web Client Javascript Framework for displaying distributed cartographic data. Among its many strengths, it can hand…

pymc3 贝叶斯线性回归_使用PyMC3进行贝叶斯媒体混合建模,带来乐趣和收益

pymc3 贝叶斯线性回归Michael Johns, Zhenyu Wang, Bruno Dupont, and Luca Fiaschi迈克尔约翰斯&#xff0c;王振宇&#xff0c;布鲁诺杜邦和卢卡菲亚斯基 “If you can’t measure it, you can’t manage it, or fix it”“如果无法衡量&#xff0c;就无法管理或修复它” –…

ols线性回归_普通最小二乘[OLS]方法使用于机器学习的简单线性回归变得容易

ols线性回归Hello Everyone!大家好&#xff01; I am super excited to be writing another article after a long time since my previous article was published.自从上一篇文章发表很长时间以来&#xff0c;我很高兴能写另一篇文章。 A Simple Linear Regression [SLR] is…

Amazon Personalize:帮助释放精益数字业务的高级推荐解决方案的功能

By Gerd Wittchen盖德维琴 推荐解决方案的动机 (Motivation for recommendation solutions) Rapid changes in customer behaviour requires businesses to adapt at an ever increasing pace. The recent changes to our work and personal life has forced entire nations t…

Linux 链接文件讲解

链接文件是Linux文件系统的一个优势。如需要在系统上维护同一文件的两份或者多份副本&#xff0c;除了保存多份单独的物理文件之外&#xff0c;可以采用保留一份物理文件副本和多个虚拟副本的方式&#xff0c;这种虚拟的副本就成为链接。链接是目录中指向文件真实位置的占位符。…

系统滚动条实现的NUD控件Unusable版

昨天研究了一下系统滚动条&#xff0c;准备使用它来实现一个NumericUpDown控件&#xff0c;因为它可以带来最正宗的微调按钮外观&#xff0c;并说了一下可以使用viewport里的onScroll事件来获取系统滚动条的上下点击动作。 同时昨天还说了onScroll事件的一个问题是&#xf…

[习题].FindControl()方法 与 PlaceHolder控件 #2(动态加入「子控件」的事件)

这是我的文章备份&#xff0c;有空请到我的网站走走&#xff0c; http://www.dotblogs.com.tw/mis2000lab/ 才能掌握我提供的第一手信息&#xff0c;谢谢您。 http://www.dotblogs.com.tw/mis2000lab/archive/2011/07/26/placeholder_findcontrol_eventhandler.aspx [习题].Fi…

西雅图治安_数据科学家对西雅图住宿业务的分析

西雅图治安介绍 (Introduction) Airbnb provides an online platform for hosts to accommodate guests with short-term lodging. Guests can search for lodging using filters such as lodging type, dates, location, and price, and can search for specific types of hom…

【贪心】买卖股票的最佳时机含手续费

/** 贪心&#xff1a;每次选取更低的价格买入&#xff0c;遇到高于买入的价格就出售(此时不一定是最大收益)。* 使用buy表示买入股票的价格和手续费的和。遍历数组&#xff0c;如果后面的股票价格加上手续费* 小于buy&#xff0c;说明有更低的买入价格更新buy。如…

排序算法Java代码实现(二)—— 冒泡排序

本篇内容&#xff1a; 冒泡排序冒泡排序 算法思想&#xff1a; 冒泡排序的原理是&#xff1a;从左到右&#xff0c;相邻元素进行比较。 每次比较一轮&#xff0c;就会找到序列中最大的一个或最小的一个。这个数就会从序列的最右边冒出来。 代码实现&#xff1a; /*** */ packag…