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

电商支付网站建设费进什么科目wordpress软件产品主题

电商支付网站建设费进什么科目,wordpress软件产品主题,深圳创业板,网页设计策划案案模板文章目录 1、任务描述2、人脸检测模型3、完整代码4、结果展示5、涉及到的库函数6、参考 1、任务描述 基于质心实现多目标#xff08;以人脸为例#xff09;跟踪 人脸检测采用深度学习的方法 核心步骤#xff1a; 步骤#1#xff1a;接受边界框坐标并计算质心 步骤#2… 文章目录 1、任务描述2、人脸检测模型3、完整代码4、结果展示5、涉及到的库函数6、参考 1、任务描述 基于质心实现多目标以人脸为例跟踪 人脸检测采用深度学习的方法 核心步骤 步骤#1接受边界框坐标并计算质心 步骤#2计算新边界框和现有对象之间的欧几里得距离 步骤 #3更新现有对象的 (x, y) 坐标 步骤#4注册新对象 步骤#5注销旧对象 当旧对象无法与任何现有对象匹配总共 N 个后续帧时我们将取消注册。 2、人脸检测模型 输入 1x3x300x300 resnet ssd分支还是挺多的 3、完整代码 质心跟踪代码 # import the necessary packages from scipy.spatial import distance as dist from collections import OrderedDict import numpy as npclass CentroidTracker():def __init__(self, maxDisappeared65):# initialize the next unique object ID along with two ordered# dictionaries used to keep track of mapping a given object# ID to its centroid and number of consecutive frames it has# been marked as disappeared, respectivelyself.nextObjectID 0# 用于为每个对象分配唯一 ID 的计数器。如果对象离开帧并且在 maxDisappeared 帧中没有返回则将分配一个新的下一个对象 ID。self.objects OrderedDict()# 对象 ID 作为键质心 (x, y) 坐标作为值的字典self.disappeared OrderedDict()# 保存特定对象 ID键已被标记为“丢失”的连续帧数值# store the number of maximum consecutive frames a given# object is allowed to be marked as disappeared until we# need to deregister the object from trackingself.maxDisappeared maxDisappeared# 在我们取消注册该对象之前允许将对象标记为“丢失/消失”的连续帧数。def register(self, centroid):# when registering an object we use the next available object# ID to store the centroid# 注册新的 idself.objects[self.nextObjectID] centroidself.disappeared[self.nextObjectID] 0self.nextObjectID 1def deregister(self, objectID):# to deregister an object ID we delete the object ID from# both of our respective dictionaries# 注销掉 iddel self.objects[objectID]del self.disappeared[objectID]def update(self, rects):# check to see if the list of input bounding box rectangles# is empty# rects (startX, startY, endX, endY)if len(rects) 0: # 没有检测到目标# loop over any existing tracked objects and mark them# as disappeared# 我们将遍历所有对象 ID 并增加它们的disappeared计数for objectID in list(self.disappeared.keys()):self.disappeared[objectID] 1# if we have reached a maximum number of consecutive# frames where a given object has been marked as# missing, deregister itif self.disappeared[objectID] self.maxDisappeared:self.deregister(objectID)# return early as there are no centroids or tracking info# to updatereturn self.objects# initialize an array of input centroids for the current frameinputCentroids np.zeros((len(rects), 2), dtypeint)# loop over the bounding box rectanglesfor (i, (startX, startY, endX, endY)) in enumerate(rects):# use the bounding box coordinates to derive the centroidcX int((startX endX) / 2.0) # 检测框中心横坐标cY int((startY endY) / 2.0) # 检测框中心纵坐标inputCentroids[i] (cX, cY)# if we are currently not tracking any objects take the input# centroids and register each of them# 如果当前没有我们正在跟踪的对象我们将注册每个新对象if len(self.objects) 0:for i in range(0, len(inputCentroids)):self.register(inputCentroids[i])# otherwise, are are currently tracking objects so we need to# try to match the input centroids to existing object# centroidselse:# grab the set of object IDs and corresponding centroidsobjectIDs list(self.objects.keys())objectCentroids list(self.objects.values())# compute the distance between each pair of object# centroids and input centroids, respectively -- our# goal will be to match an input centroid to an existing# object centroidD dist.cdist(np.array(objectCentroids), inputCentroids)# in order to perform this matching we must (1) find the# smallest value in each row and then (2) sort the row# indexes based on their minimum values so that the row# with the smallest value as at the *front* of the index# listrows D.min(axis1).argsort()# next, we perform a similar process on the columns by# finding the smallest value in each column and then# sorting using the previously computed row index listcols D.argmin(axis1)[rows]# in order to determine if we need to update, register,# or deregister an object we need to keep track of which# of the rows and column indexes we have already examinedusedRows set()usedCols set()# loop over the combination of the (row, column) index# tuplesfor (row, col) in zip(rows, cols):# if we have already examined either the row or# column value before, ignore it# val# 老目标被选中过或者新目标被选中过if row in usedRows or col in usedCols:continue# otherwise, grab the object ID for the current row,# set its new centroid, and reset the disappeared# counterobjectID objectIDs[row] # 老目标 idself.objects[objectID] inputCentroids[col] # 更新老目标 id 的质心为新目标的质心因为两者距离最近self.disappeared[objectID] 0 # 丢失索引重置为 0# indicate that we have examined each of the row and# column indexes, respectivelyusedRows.add(row)usedCols.add(col)# compute both the row and column index we have NOT yet# examinedunusedRows set(range(0, D.shape[0])).difference(usedRows)unusedCols set(range(0, D.shape[1])).difference(usedCols)# in the event that the number of object centroids is# equal or greater than the number of input centroids# we need to check and see if some of these objects have# potentially disappeared# 如果老目标不少于新目标if D.shape[0] D.shape[1]:# loop over the unused row indexesfor row in unusedRows:# grab the object ID for the corresponding row# index and increment the disappeared counterobjectID objectIDs[row] # 老目标 idself.disappeared[objectID] 1 # 跟踪帧数 1# check to see if the number of consecutive# frames the object has been marked disappeared# for warrants deregistering the object# 检查disappeared计数是否超过 maxDisappeared 阈值如果是我们将注销该对象if self.disappeared[objectID] self.maxDisappeared:self.deregister(objectID)# otherwise, if the number of input centroids is greater# than the number of existing object centroids we need to# register each new input centroid as a trackable objectelse: # 新目标多于老目标for col in unusedCols:self.register(inputCentroids[col]) # 注册新目标# return the set of trackable objectsreturn self.objectsself.nextObjectID 0用于为每个对象分配唯一 ID 的计数器。如果对象离开帧并且在 maxDisappeared 帧中没有返回则将分配一个新的下一个对象 ID。 self.objects OrderedDict() 对象 ID 作为键质心 (x, y) 坐标作为值的字典 self.disappeared OrderedDict() 保存特定对象 ID键已被标记为“丢失”的连续帧数值 self.maxDisappeared maxDisappeared在我们取消注册该对象之前允许将对象标记为“丢失/消失”的连续帧数。 有初始化注册注销更新过程 核心代码在 def update 如果没有检测到目标当前所有 id 的 self.disappeared 会加 1 如果注册的 id 为空这当前帧所有质心会被注册上新的 id否则会计算历史质心和当前帧质心的距离距离较近的匹配上更新 id 的质心没有被分配上的历史质心对应 id 的 self.disappeared 会加 1没有被分配的当前帧质心会被注册新的 id 超过 self.maxDisappeared 的 id 会被注销掉 根据 D 计算 rows 和 cols 的时候有点绕看看下面这段注释就会好理解一些 Darray([[ 2. , 207.48252939],[206.65188119, 1.41421356]])D.min(axis1) 每行最小值array([2. , 1.41421356])rows 每行最小值再排序表示按从小到大行数排序比如最小的数在rows[0]所在的行第二小的数在rows[1]所在的行array([1, 0])D.argmin(axis1) 返回指定轴最小值的索引也即每行最小值的索引array([0, 1])cols 每行每列最小值按行从小到大排序array([1, 0])再看看一个 shape 不一样的例子 import numpy as npD np.array([[2., 1, 3],[1.1, 1.41421356, 0.7]])print(D.min(axis1)) print(D.argmin(axis1))rows D.min(axis1).argsort()cols D.argmin(axis1)[rows]print(rows) print(cols) [1. 0.7] [1 2][1 0] [2 1]实际运用的时候rows 是历史 idscols 是当前帧的 ids 人脸检测跟踪绘制结果 pipeline # USAGE # python object_tracker.py --prototxt deploy.prototxt --model res10_300x300_ssd_iter_140000.caffemodel# import the necessary packages from CentroidTracking.centroidtracker import CentroidTracker import numpy as np import argparse import imutils import cv2# construct the argument parse and parse the arguments ap argparse.ArgumentParser() ap.add_argument(-p, --prototxt, defaultdeploy.prototxt.txt,helppath to Caffe deploy prototxt file) ap.add_argument(-m, --model, defaultres10_300x300_ssd_iter_140000.caffemodel,helppath to Caffe pre-trained model) ap.add_argument(-c, --confidence, typefloat, default0.5,helpminimum probability to filter weak detections) args vars(ap.parse_args())# initialize our centroid tracker and frame dimensions ct CentroidTracker() (H, W) (None, None)# load our serialized model from disk print([INFO] loading model...) net cv2.dnn.readNetFromCaffe(args[prototxt], args[model])# initialize the video stream print([INFO] starting video stream...) vs cv2.VideoCapture(4.mp4)index 0# loop over the frames from the video stream while True:index 1# read the next frame from the video stream and resize itrect, frame vs.read()if not rect:breakframe imutils.resize(frame, width600)(H, W) frame.shape[:2]# construct a blob from the frame, pass it through the network,# obtain our output predictions, and initialize the list of# bounding box rectanglesblob cv2.dnn.blobFromImage(frame, 1.0, (W, H),(104.0, 177.0, 123.0))net.setInput(blob)detections net.forward() # (1, 1, 200, 7)detections[0][0][0]array([0. , 1. , 0.9983138 , 0.418003 , 0.22666326,0.5242793 , 0.50829136], dtypefloat32)第三个维度是 score最后四个维度是左上右下坐标rects [] # 记录所有检测框的左上右下坐标# loop over the detectionsfor i in range(0, detections.shape[2]):# filter out weak detections by ensuring the predicted# probability is greater than a minimum thresholdif detections[0, 0, i, 2] args[confidence]:# compute the (x, y)-coordinates of the bounding box for# the object, then update the bounding box rectangles listbox detections[0, 0, i, 3:7] * np.array([W, H, W, H])rects.append(box.astype(int))# draw a bounding box surrounding the object so we can# visualize it(startX, startY, endX, endY) box.astype(int)cv2.rectangle(frame, (startX, startY), (endX, endY),(0, 0, 255), 2)# update our centroid tracker using the computed set of bounding# box rectanglesobjects ct.update(rects)# loop over the tracked objectsfor (objectID, centroid) in objects.items():# draw both the ID of the object and the centroid of the# object on the output frametext ID {}.format(objectID)cv2.putText(frame, text, (centroid[0] - 10, centroid[1] - 10),cv2.FONT_HERSHEY_SIMPLEX, 0.5, (0, 0, 255), 2)cv2.circle(frame, (centroid[0], centroid[1]), 4, (0, 0, 255), -1)# show the output framecv2.imshow(Frame, frame)# cv2.imwrite(f./frame4/{str(index).zfill(3)}.jpg, frame)key cv2.waitKey(1) 0xFF# if the q key was pressed, break from the loopif key ord(q):break# do a bit of cleanup cv2.destroyAllWindows() vs.release()网络前向后的结果第三个维度是 score最后四个维度是左上右下坐标 核心跟新坐标的过程在 objects ct.update(rects) 4、结果展示 单个人脸 tracking-face1 多个人脸 tracking-face2 多个人脸存在漏检情况id 还是持续了很长一段时间算法中配置的是 50 帧 tracking-face3 多个人脸 tracking-face4 5、涉及到的库函数 scipy.spatial.distance.cdist 是 SciPy 库中 spatial.distance 模块的一个函数用于计算两个输入数组之间所有点对之间的距离。这个函数非常有用特别是在处理大规模数据集时需要计算多个点之间的距离矩阵。 函数的基本用法如下 from scipy.spatial.distance import cdist # 假设 XA 和 XB 是两个二维数组其中每一行代表一个点的坐标 XA ... # 形状为 (m, n) 的数组m 是点的数量n 是坐标的维度 XB ... # 形状为 (p, n) 的数组p 是另一个集合中点的数量 # 计算 XA 和 XB 中所有点对之间的距离 # metric 参数指定使用的距离度量默认为 euclidean欧氏距离 D cdist(XA, XB, metriceuclidean)在这个例子中D 将是一个形状为 (m, p) 的数组其中 D[i, j] 表示 XA 中第 i 个点和 XB 中第 j 个点之间的距离。 cdist 函数支持多种距离度量通过 metric 参数指定。除了默认的欧氏距离外还可以选择如曼哈顿距离‘cityblock’、切比雪夫距离‘chebyshev’、闵可夫斯基距离‘minkowski’需要额外指定 p 值、余弦距离注意虽然余弦通常用作相似度度量但可以通过 1 - cosine(u, v) 转换为距离度量不过 cdist 不直接支持负的余弦距离需要手动计算、汉明距离‘hamming’仅适用于布尔数组或整数数组等。 6、参考 https://github.com/gopinath-balu/computer_visionhttps://pyimagesearch.com/2018/07/23/simple-object-tracking-with-opencv/链接https://pan.baidu.com/s/1UX_HmwwJLtHJ9e5tx6hwOg?pwd123a 提取码123a目标跟踪7使用 OpenCV 进行简单的对象跟踪https://pixabay.com/zh/videos/woman-phone-business-casual-154833/
http://www.sczhlp.com/news/245137/

相关文章:

  • 无忧网站优化购买域名网
  • 做百度手机网站快速排网站开发语言是什么意思
  • 百度提交网站已删内容今天最新的新闻头条新闻
  • nginx配置文件
  • TCP与UDP
  • 人工智能之编程基础 Python 入门:第三章 基础语法
  • 申请注册商标需要多少钱北京seo招聘
  • 网站建设需要找工信部吗手机端网站怎么做
  • 企业网站建设专业服务广东网站营销seo方案
  • 岳阳网站建设开发制作网站怎么做的
  • 网站后台在哪里各行各业网站建设
  • 网站开发为什么需要域名山东省建设局拖欠工资网站
  • 网站设计用处wordpress如何添加ssl证书
  • 婚礼工作室网站模板中企动力科技怎么样
  • 鄂州网站建设网站开发与客户沟通
  • 哈尔滨优化网站方法浙江杭州seo网站建设网站优化
  • 企业建设网站专业服务北京网站制作招聘网
  • 获取整个网站源码工具企业邮箱申请哪个
  • 保定学校网站建设网站建设之网页制作语言基础
  • 没有网站做APP门户网站编辑联系方式
  • 网站数据库怎么建立wordpress无头像
  • 网站开发需要什么技术人员设计一套网站多少钱
  • 免费行情软件网站游戏安卓开发工程师月薪
  • 哪个网站可以做线上翻译赚钱建立一个购物网站
  • 公司网站制作都需要图片wordpress无法登录后台
  • 做设计需要素材的常用网站品质商城网站建设
  • 网站建设原则包括哪些内容英德网站建设
  • 建立网站目录结构时应注意哪几个方面?网站建设找客户
  • 360关键词竞价网站网站空间 哪个公司好
  • 免费域名网站搭建网站名字设计