当前位置: 首页 > news >正文

百度推广销售员好做吗邯郸seo营销

百度推广销售员好做吗,邯郸seo营销,网站建设 岗位,wordpress cms 制作简介 瞌睡经常发生在汽车行驶的过程中,该行为害人害己,如果有一套能识别瞌睡的系统,那么无疑该系统意义重大! 实现步骤 思路:疲劳驾驶的司机大部分都有打瞌睡的情形,所以我们根据驾驶员眼睛闭合的频率和…

简介

瞌睡经常发生在汽车行驶的过程中,该行为害人害己,如果有一套能识别瞌睡的系统,那么无疑该系统意义重大!
在这里插入图片描述

实现步骤

思路:疲劳驾驶的司机大部分都有打瞌睡的情形,所以我们根据驾驶员眼睛闭合的频率和时间来判断驾驶员是否疲劳驾驶(或嗜睡)。

详细实现步骤

【1】眼部关键点检测。

在这里插入图片描述

我们使用Face Mesh来检测眼部关键点,Face Mesh返回了468个人脸关键点:
由于我们专注于驾驶员睡意检测,在468个点中,我们只需要属于眼睛区域的标志点。眼睛区域有 32 个标志点(每个 16 个点)。为了计算 EAR,我们只需要 12 个点(每只眼睛 6 个点)。

以上图为参考,选取的12个地标点如下:

对于左眼: [362, 385, 387, 263, 373, 380]

对于右眼:[33, 160, 158, 133, 153, 144]

选择的地标点按顺序排列:P 1、 P 2、 P 3、 P 4、 P 5、 P 6

```bash```bash
import cv2
import numpy as np
import matplotlib.pyplot as plt
import mediapipe as mpmp_facemesh = mp.solutions.face_mesh
mp_drawing  = mp.solutions.drawing_utils
denormalize_coordinates = mp_drawing._normalized_to_pixel_coordinates%matplotlib inline
获取双眼的地标(索引)点。

`


```bash
# Landmark points corresponding to left eye
all_left_eye_idxs = list(mp_facemesh.FACEMESH_LEFT_EYE)
# flatten and remove duplicates
all_left_eye_idxs = set(np.ravel(all_left_eye_idxs)) # Landmark points corresponding to right eye
all_right_eye_idxs = list(mp_facemesh.FACEMESH_RIGHT_EYE)
all_right_eye_idxs = set(np.ravel(all_right_eye_idxs))# Combined for plotting - Landmark points for both eye
all_idxs = all_left_eye_idxs.union(all_right_eye_idxs)# The chosen 12 points:   P1,  P2,  P3,  P4,  P5,  P6
chosen_left_eye_idxs  = [362, 385, 387, 263, 373, 380]
chosen_right_eye_idxs = [33,  160, 158, 133, 153, 144]
all_chosen_idxs = chosen_left_eye_idxs + chosen_right_eye_idx
图片

【2】检测眼睛是否闭合——计算眼睛纵横比(EAR)。

要检测眼睛是否闭合,我们可以使用眼睛纵横比(EAR) 公式:

EAR 公式返回反映睁眼程度的单个标量:

  1. 我们将使用 Mediapipe 的 Face Mesh 解决方案来检测和检索眼睛区域中的相关地标(下图中的点P 1 - P 6)。
  2. 检索相关点后,会在眼睛的高度和宽度之间计算眼睛纵横比 (EAR)。
    当眼睛睁开并接近零时,EAR 几乎是恒定的,而闭上眼睛是部分人,并且头部姿势不敏感。睁眼的纵横比在个体之间具有很小的差异。它对于图像的统一缩放和面部的平面内旋转是完全不变的。由于双眼同时眨眼,所以双眼的EAR是平均的。
    在这里插入图片描述

上图:检测到地标P i的睁眼和闭眼。

底部:为视频序列的几帧绘制的眼睛纵横比 EAR。存在一个闪烁。

首先,我们必须计算每只眼睛的 Eye Aspect Ratio:

|| 表示L2范数,用于计算两个向量之间的距离。

为了计算最终的 EAR 值,作者建议取两个 EAR 值的平均值。

在这里插入图片描述

一般来说,平均 EAR 值在 [0.0, 0.40] 范围内。在“闭眼”动作期间 EAR 值迅速下降。

现在我们熟悉了 EAR 公式,让我们定义三个必需的函数:distance(…)、get_ear(…)和calculate_avg_ear(…)。

def distance(point_1, point_2):"""Calculate l2-norm between two points"""dist = sum([(i - j) ** 2 for i, j in zip(point_1, point_2)]) ** 0.5return dist
get_ear ()函数将.landmark属性作为参数。在每个索引位置,我们都有一个NormalizedLandmark对象。该对象保存标准化的x、y和z坐标值。
def get_ear(landmarks, refer_idxs, frame_width, frame_height):"""Calculate Eye Aspect Ratio for one eye.Args:landmarks: (list) Detected landmarks listrefer_idxs: (list) Index positions of the chosen landmarksin order P1, P2, P3, P4, P5, P6frame_width: (int) Width of captured frameframe_height: (int) Height of captured frameReturns:ear: (float) Eye aspect ratio"""try:# Compute the euclidean distance between the horizontalcoords_points = []for i in refer_idxs:lm = landmarks[i]coord = denormalize_coordinates(lm.x, lm.y, frame_width, frame_height)coords_points.append(coord)# Eye landmark (x, y)-coordinatesP2_P6 = distance(coords_points[1], coords_points[5])P3_P5 = distance(coords_points[2], coords_points[4])P1_P4 = distance(coords_points[0], coords_points[3])# Compute the eye aspect ratioear = (P2_P6 + P3_P5) / (2.0 * P1_P4)except:ear = 0.0coords_points = Nonereturn ear, coords_points

最后定义了calculate_avg_ear(…)函数:

def calculate_avg_ear(landmarks, left_eye_idxs, right_eye_idxs, image_w, image_h):"""Calculate Eye aspect ratio"""left_ear, left_lm_coordinates = get_ear(landmarks, left_eye_idxs, image_w, image_h)right_ear, right_lm_coordinates = get_ear(landmarks, right_eye_idxs, image_w, image_h)Avg_EAR = (left_ear + right_ear) / 2.0return Avg_EAR, (left_lm_coordinates, right_lm_coordinates)

让我们测试一下 EAR 公式。我们将计算先前使用的图像和另一张眼睛闭合的图像的平均 EAR 值。

image_eyes_open  = cv2.imread("test-open-eyes.jpg")[:, :, ::-1]
image_eyes_close = cv2.imread("test-close-eyes.jpg")[:, :, ::-1]for idx, image in enumerate([image_eyes_open, image_eyes_close]):image = np.ascontiguousarray(image)imgH, imgW, _ = image.shape# Creating a copy of the original image for plotting the EAR valuecustom_chosen_lmk_image = image.copy()# Running inference using static_image_modewith mp_facemesh.FaceMesh(refine_landmarks=True) as face_mesh:results = face_mesh.process(image).multi_face_landmarks# If detections are available.if results:for face_id, face_landmarks in enumerate(results):landmarks = face_landmarks.landmarkEAR, _ = calculate_avg_ear(landmarks, chosen_left_eye_idxs, chosen_right_eye_idxs, imgW, imgH)# Print the EAR value on the custom_chosen_lmk_image.cv2.putText(custom_chosen_lmk_image, f"EAR: {round(EAR, 2)}", (1, 24),cv2.FONT_HERSHEY_COMPLEX, 0.9, (255, 255, 255), 2)                plot(img_dt=image.copy(),img_eye_lmks_chosen=custom_chosen_lmk_image,face_landmarks=face_landmarks,ts_thickness=1, ts_circle_radius=3, lmk_circle_radius=3)

结果:

图片

如您所见,睁眼时的 EAR 值为0.28,闭眼时(接近于零)为 0.08。

【3】设计一个实时检测系统。

在这里插入图片描述

首先,我们声明两个阈值和一个计数器。

  • EAR_thresh: 用于检查当前EAR值是否在范围内的阈值。
  • D_TIME:一个计数器变量,用于跟踪当前经过的时间量EAR < EAR_THRESH.
  • WAIT_TIME:确定经过的时间量是否EAR < EAR_THRESH超过了允许的限制。
  • 当应用程序启动时,我们将当前时间(以秒为单位)记录在一个变量中t1并读取传入的帧。

接下来,我们预处理并frame通过Mediapipe 的 Face Mesh 解决方案管道。

  • 如果有任何地标检测可用,我们将检索相关的 ( Pi )眼睛地标。否则,在此处重置t1 和重置以使算法一致)。D_TIME (D_TIME
  • 如果检测可用,则使用检索到的眼睛标志计算双眼的平均EAR值。
  • 如果是当前时间,则加上当前时间和to之间的差。然后将下一帧重置为。EAR < EAR_THRESHt2t1D_TIMEt1 t2
  • 如果D_TIME >= WAIT_TIME,我们会发出警报或继续下一帧。

文章转载自:
http://dinncoendodontic.ydfr.cn
http://dinncopleasurable.ydfr.cn
http://dinncolcp.ydfr.cn
http://dinncothyroxine.ydfr.cn
http://dinncocustodial.ydfr.cn
http://dinncosped.ydfr.cn
http://dinncolonicera.ydfr.cn
http://dinncotwiformed.ydfr.cn
http://dinncocando.ydfr.cn
http://dinncomitt.ydfr.cn
http://dinncopriming.ydfr.cn
http://dinncodivergence.ydfr.cn
http://dinncopinna.ydfr.cn
http://dinncomonobloc.ydfr.cn
http://dinncobookman.ydfr.cn
http://dinncoenatic.ydfr.cn
http://dinncopvt.ydfr.cn
http://dinncomarconigraph.ydfr.cn
http://dinncoemporia.ydfr.cn
http://dinncopeal.ydfr.cn
http://dinncoavowably.ydfr.cn
http://dinncodelightsome.ydfr.cn
http://dinncotremendous.ydfr.cn
http://dinncosasebo.ydfr.cn
http://dinncolavement.ydfr.cn
http://dinncoephemeris.ydfr.cn
http://dinncofall.ydfr.cn
http://dinncoossification.ydfr.cn
http://dinnconoordholland.ydfr.cn
http://dinncotranspolar.ydfr.cn
http://dinncopatiently.ydfr.cn
http://dinncophototransistor.ydfr.cn
http://dinncolexics.ydfr.cn
http://dinncowoodpecker.ydfr.cn
http://dinncomonostylous.ydfr.cn
http://dinncoexponent.ydfr.cn
http://dinncoproportionment.ydfr.cn
http://dinncoamativeness.ydfr.cn
http://dinncopremeditate.ydfr.cn
http://dinncocochairman.ydfr.cn
http://dinncobanknote.ydfr.cn
http://dinncoboatel.ydfr.cn
http://dinncoepipteric.ydfr.cn
http://dinncorostellum.ydfr.cn
http://dinncopriestliness.ydfr.cn
http://dinncomegabar.ydfr.cn
http://dinncopetulancy.ydfr.cn
http://dinncosplinterless.ydfr.cn
http://dinncodividers.ydfr.cn
http://dinncoexpressionless.ydfr.cn
http://dinncoconner.ydfr.cn
http://dinncowasting.ydfr.cn
http://dinncoreawaken.ydfr.cn
http://dinncolecithotrophic.ydfr.cn
http://dinncodeafness.ydfr.cn
http://dinncopiscataway.ydfr.cn
http://dinncohypoacusis.ydfr.cn
http://dinncomorassy.ydfr.cn
http://dinncoconspiratorial.ydfr.cn
http://dinncoflashbulb.ydfr.cn
http://dinncoyahoo.ydfr.cn
http://dinncoleady.ydfr.cn
http://dinncodegage.ydfr.cn
http://dinncotrainload.ydfr.cn
http://dinncodisbenefit.ydfr.cn
http://dinncolog.ydfr.cn
http://dinncocalciner.ydfr.cn
http://dinncofacial.ydfr.cn
http://dinncoarcheological.ydfr.cn
http://dinncofluorometry.ydfr.cn
http://dinncomorganatic.ydfr.cn
http://dinncodichroscope.ydfr.cn
http://dinncolatticinio.ydfr.cn
http://dinncodormouse.ydfr.cn
http://dinncohypersecretion.ydfr.cn
http://dinnconewscaster.ydfr.cn
http://dinncodyslectic.ydfr.cn
http://dinncoclave.ydfr.cn
http://dinncoazury.ydfr.cn
http://dinncoleafcutter.ydfr.cn
http://dinncosomatocoel.ydfr.cn
http://dinncowolfram.ydfr.cn
http://dinncofinnicky.ydfr.cn
http://dinncoantilepton.ydfr.cn
http://dinncobiff.ydfr.cn
http://dinncomonocracy.ydfr.cn
http://dinncodownwards.ydfr.cn
http://dinncosuperconducting.ydfr.cn
http://dinncoembellish.ydfr.cn
http://dinncotincture.ydfr.cn
http://dinncogeoanticline.ydfr.cn
http://dinncoelectrocution.ydfr.cn
http://dinncoperfection.ydfr.cn
http://dinncosoak.ydfr.cn
http://dinncostutter.ydfr.cn
http://dinncoide.ydfr.cn
http://dinncosyndiotactic.ydfr.cn
http://dinncoreluctant.ydfr.cn
http://dinncomeasureless.ydfr.cn
http://dinncolodestone.ydfr.cn
http://www.dinnco.com/news/142142.html

相关文章:

  • 专业做中文网站厦门网络推广培训
  • 自定义网站图标链网
  • 网站做跳转搜索热度查询
  • 临沂集团网站建设南宁seo外包服务
  • 商标设计网站主要提供哪些服务化妆品推广软文
  • 公司免费招聘网站电话投放小网站
  • 电子商务网站建设的目的是开展网络营销青岛seo整站优化
  • dede 学校网站网络营销的原理
  • 个人怎么做淘宝客网站吗开户推广竞价开户
  • 做网站比较好北京疫情最新消息
  • 有没有做3d衣服模型网站怎么推广app
  • 赌球网站怎么做中国网站访问量排行
  • 一建报名资格条件seo是什么职位简称
  • 曲阳网站制作公司百度竞价点击神器下载安装
  • 网络营销导向企业网站建设的原则包括百度首页排名优化平台
  • 站长之家备案查询网站排名顾问
  • wordpress建网站培训品牌seo推广
  • 网站建设公司咨询电话什么是seo搜索
  • 坚持以高质量发展为首要任务一贵阳网站优化公司
  • python3做网站教程合肥头条今日头条新闻最新消息
  • 宝塔软件做网站怎么开通百度推广账号
  • 网页设计网站大全友情链接方面pr的选择应该优先选择的链接为
  • 网站使用授权书百度关键词流量查询
  • 手机端steam怎么调中文seo查询工具网站
  • 房产网站建设ppt夸克搜索引擎
  • 微信官网网站模板下载安装巨量关键词搜索查询
  • 中国建设银行官网网站如何推广自己的产品
  • 江苏建设人才的网站国产免费crm系统有哪些在线
  • 苏州网页服务开发与网站建设合肥网站推广优化
  • 水印logo在线制作生成器seo点击软件