yolo opencv

介绍 (Introduction)

In this post, I will show how I detect and track players using Yolov3, Opencv and SORT from video clip, and turn the detections to the bird’s-eye view as shown above.

在这篇文章中,我将展示如何使用视频片段中的Yolov3,Opencv和SORT来检测和跟踪播放器,并将检测结果变为鸟瞰图,如上所示。

Inspired by Sam Blake’s great work (https://medium.com/hal24k-techblog/how-to-track-objects-in-the-real-world-with-tensorflow-sort-and-opencv-a64d9564ccb1), I will do the following steps for this project:

受山姆·布雷克 ( Sam Blake )的出色著作( https://medium.com/hal24k-techblog/how-to-track-objects-in-the-real-world-with-tensorflow-sort-and-opencv-a64d9564ccb1 )的启发,我将为此项目执行以下步骤:

  1. Object Detection (Yolo and Opencv)对象检测(Yolo和Opencv)
  2. Object Tracking (SORT)对象跟踪(SORT)
  3. Perspective Transform (Opencv)透视变换(Opencv)

足球视频数据集 (Football video dataset)

In order to have a stable tracking and perspective transform, I need a video clip without camera moving around. I downloaded the video from IPL Ball Detection Datasets. Please be noted that the ball is not tracked in this project, it was already tracked (green bounding box) from the source.

为了获得稳定的跟踪和透视变换,我需要一个没有相机四处移动的视频剪辑。 我从IPL球检测数据集下载了视频。 请注意,此项目未跟踪该球,它已从源中被跟踪(绿色边框)。

here)此处下载)

物体检测 (Object Detection)

The first step is to load the video and detect the players.

第一步是加载视频并检测播放器。

I used the pre-trained Yolov3 weight and used Opencv’s dnn module and only selected detections classified as ‘person’.

我使用了预先训练的Yolov3权重,并使用了Opencv的dnn模块,并且只选择了归类为“人”的检测项。

I drew bounding boxes for detected players and their tails for previous ten frames.

我为检测到的球员画了边框,并为前十帧画了他们的尾巴。

Player tracking using Yolov3 and Opencv
使用Yolov3和Opencv进行玩家跟踪

Looks like the pre-trained model is doing quite okay.

看起来像经过预训练的模型还算不错。

对象追踪 (Object Tracking)

Next I want to track the player and assign unique IDs to them. I used Alex Bewley’s SORT algorithm(simple online and realtime tracking), which I applied to my previous work.

接下来,我要跟踪播放器并为其分配唯一的ID。 我使用了Alex Bewley的SORT算法(简单的在线和实时跟踪),该算法已应用于我以前的工作中。

Player tracking using SORT.
使用SORT跟踪玩家。

Now each player has a unique ID assigned and displayed in the video.

现在,每个播放器都有一个唯一的ID,该ID已分配并显示在视频中。

透视变换 (Perspective Transform)

The video looks good now, but I still want to have players’ motion in bird’s-eye view. It can be done by doing perspective transform. There are a little bit math involved, fortunately Opencv’s getPerspectiveTransform function make it a lot easier.

该视频现在看起来不错,但我仍想以鸟瞰视角让玩家运动。 可以通过执行透视变换来完成。 涉及到一些数学运算,幸运的是, Opencv的getPerspectiveTransform函数使它变得更加容易。

I need to find 4 fixed points as reference and identify the coordinations from the video and also from the bird’s-eye view image.

我需要找到4个固定点作为参考,并从视频和鸟瞰图图像中识别出坐标。

First I identify 4 reference points from the video as show in in red spot and get the pixel coordinations.

首先,我从视频中识别出4个参考点,如红色点所示,并获得像素坐标。

np.array([        [1, 47], # Upper left        [878, 54], # Upper right        [1019, 544], # Lower right        [1, 546] # Lower left                                   ])
4 reference points marked on video(red spot)
视频上标有4个参考点(红色斑点)

I did not really see very solid reference points from the video so I roughly identified 4 points and marked these locations on the bird’s-eye view and got the corresponding pixel coordinations. It will be more precise if the reference points are more robust.

我没有从视频中真正看到非常坚实的参考点,因此我大致确定了4个点,并在鸟瞰图上标记了这些位置,并获得了相应的像素坐标。 如果参考点更健壮,它将更加精确。

np.array([        [871, 37], # Upper left        [1490, 39], # Upper right        [1458, 959], # Lower right        [1061, 955] # Lower left                                   ])
4 reference points marked on bird’s-eye view(red spot)
鸟瞰图上标有4个参考点(红色斑点)

Then by applying Opencv’s getPerspectiveTransform using these reference points, we can transform the detections from video to bird’s-eye view.

然后,通过使用这些参考点应用Opencv的getPerspectiveTransform ,我们可以将检测结果从视频转换为鸟瞰图。

Player tracking on video and bird’s-eye view.
播放器跟踪视频和鸟瞰图。

With player’s movement information, it is possible to do further analysis such as players’ running distance and velocity.

利用运动员的运动信息,可以进行进一步分析,例如运动员的跑步距离和速度。

The speed for running this player tracking is around 0.3 second per frame on my 2016 Macbook Pro Intel i5 CPU. It is possible to do this real time by using GPU for some applications if necessary.

在我的2016 Macbook Pro Intel i5 CPU上,运行此播放器跟踪的速度约为每帧0.3秒。 如有必要,可以通过将GPU用于某些应用程序来实时执行此操作。

Thanks for reading, comments and suggestions are welcome!

感谢您的阅读,欢迎提出意见和建议!

In my next post, I used OpenCV to identify players’s team based on their jersey color. Feel free to take a look!

在我的下一篇文章中,我使用OpenCV根据球员的球衣颜色来识别他们的球队。 随意看看!

翻译自: https://towardsdatascience.com/how-to-track-football-players-using-yolo-sort-and-opencv-6c58f71120b8

yolo opencv


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

相关文章:

  • 人工智能的搭便车指南
  • 机器学习 对回归的评估_在机器学习回归问题中应使用哪种评估指标?
  • 可持久化数据结构加扫描线_结构化光扫描
  • 信号处理深度学习机器学习_机器学习和信号处理如何融合?
  • python 数组合并排重_并排深度学习:Julia vs Python
  • 强化学习 求解迷宫问题_使用天真强化学习的迷宫求解器
  • 朴素贝叶斯 半朴素贝叶斯_使用朴素贝叶斯和N-Gram的Twitter情绪分析
  • 自动填充数据新增测试数据_用测试数据填充员工数据库
  • bart使用方法_使用简单变压器的BART释义
  • 卷积网络和卷积神经网络_卷积神经网络的眼病识别
  • 了解回归:迈向机器学习的第一步
  • yolo yolov2_PP-YOLO超越YOLOv4 —对象检测的进步
  • 机器学习初学者_绝对初学者的机器学习
  • monk js_对象检测-使用Monk AI进行文档布局分析
  • 线性回归 c语言实现_C ++中的线性回归实现
  • 忍者必须死3 玩什么忍者_降维:忍者新手
  • 交叉验证和超参数调整:如何优化您的机器学习模型
  • 安装好机器学习环境的虚拟机_虚拟环境之外的数据科学是弄乱机器的好方法
  • 遭遇棘手 交接_Librosa的城市声音分类-棘手的交叉验证
  • 模型越复杂越容易惰性_ML模型的惰性预测
  • vgg 名人人脸图像库_您看起来像哪个名人? 图像相似度搜索模型
  • 机器学习:贝叶斯和优化方法_Facebook使用贝叶斯优化在机器学习模型中进行更好的实验
  • power-bi_在Power BI中的VertiPaq内-压缩成功!
  • 模型 标签数据 神经网络_大型神经网络和小数据的模型选择
  • 学习excel数据分析_为什么Excel是学习数据分析的最佳方法
  • 护理方面关于人工智能的构想_如何提出惊人的AI,ML或数据科学项目构想。
  • api数据库管理_API管理平台如何增强您的数据科学项目
  • batch lr替代关系_建立关系的替代方法
  • ai/ml_您本周应阅读的有趣的AI / ML文章(8月9日)
  • snowflake 使用_如何使用机器学习模型直接从Snowflake进行预测

yolo opencv_如何使用Yolo,SORT和Opencv跟踪足球运动员。相关推荐

  1. linux下运行yolo,Linux下 安装YOLO

    8种机械键盘轴体对比 本人程序员,要买一个写代码的键盘,请问红轴和茶轴怎么选? YOLO 是一个实时的目标检测框架. 最近由于实验室需要进行实验,所以要在服务器上对于YOLO进行安装.YOLO的网址为 ...

  2. OpenCV跟踪支持的实例(附完整源代码)

    OpenCV跟踪支持的实例 OpenCV跟踪支持的实例 OpenCV跟踪支持的实例 #include <iostream> #include <opencv2/core.hpp> ...

  3. 【yolo】ubuntu18.04 yolo打开摄像头实时检测框目标 转化pth文件为onnx

    heziyi@heziyi-ZenBook-UX425IA-U4700IA:~/桌面/PyTorch-YOLOv3$ python3 video.py yolov3_ckpt_69.onnx Trac ...

  4. Yolo(2)Yolo v2

    目录 Yolo v2改进 1.引入BP层 2.更高精度的分类器 3.引入anchor 定义: anchor理解: 目标: 4.细粒度特征 5.多尺度 Yolo v2改进 yolo v2 VS yolo ...

  5. Yolo(1)Yolo v1

    目录 一.基础理论 优缺点 二.过程 1.对每张图像打格 2.损失函数 2-1.损失函数介绍 2-2.参数介绍 2-3.注意事项 一.基础理论 步骤1:生成备选框. 步骤2:从备选框中找出物体边框. ...

  6. [YOLO专题-11]:YOLO V5 - ultralytics/train基于自定义图片数据集重新训练网络, 完成自己的目标检测

    作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客 本文网址:https://blog.csdn.net/HiWangWenBing/article/detai ...

  7. [YOLO专题-4]:YOLO V1 - 网络结构、原理、基本思想的全新、全面、通俗、结构化讲解

    作者主页(文火冰糖的硅基工坊):文火冰糖(王文兵)的博客_文火冰糖的硅基工坊_CSDN博客 本文网址:https://blog.csdn.net/HiWangWenBing/article/detai ...

  8. ①YOLO v1~v3、②YOLO v3 SPP、③IoU、GIoU、DIoU、CIoU、④Focal Loss的理论讲解

    0. 引言 0.1 安排 YOLO v1 (简单理论) YOLO v2 (简单理论) YOLO v3 (详细理论) YOLO v3 SPP (trick扩充 + 代码讲解) IoU.GIoU.DIoU ...

  9. c++ python opencv_从C++到Python的OpenCV垫

    我需要从C++发送一个OpenCV图像到Python来进行一些处理. Mat将通过代码接收,但为了简单起见,我使用imread来回答问题.在< >我在代码的C++部分中所做的是:#incl ...

最新文章

  1. mySql 主从复制linux配置
  2. js笔记 - ajax中的get和post说明
  3. python调用c 接口_python调用C接口
  4. c语言源程序结构是怎样的?
  5. ScriptProcessorNode
  6. Jquery设置select控件指定text的值为选中项
  7. 如何给网站添加支付宝支付功能
  8. apk一键脱壳工具_一键新机!强大的抹机王来了!
  9. 运维工程师必须掌握的基础技能有哪些?
  10. 51单片机c语言音乐盒设计,基于51单片机的音乐盒课程设计开题报告精品
  11. 经验谈:调查问卷问题设计“六忌”
  12. ubuntu20.04安装qq和微信
  13. uni-app获取省市区详细位置信息
  14. 怎么把做好的ps保存成图片_PS保存图片提示“无法完成请求”,这里有4种解决方法...
  15. 财管毕业论文哪些题目比较好写?
  16. dreamweaver排列顺序怎么用_Dreamweaver使用技巧
  17. person_reID
  18. R统计-微生物群落结构差异分析及结果解读
  19. curl php 不直接输出,php – 使用cUrl时没有输出
  20. 恋爱游戏该怎么做?恋爱游戏+可以是什么?

热门文章

  1. 最全Kafka 设计与原理详解【2017.9全新】
  2. 【WPF】获取电磁笔的压感
  3. 如何防御syn flood的一些思路!
  4. Web前端一种动态样式语言-- Less
  5. Mac OS X安装Lua
  6. VueJS 开发常见问题集锦
  7. labelimg如何调整框的颜色_P图改字:来看看吧!教你如何用PS墙壁发光灯泡广告文字图片...
  8. linux系统调试网络,linux系统命令(网络相关的调试命令)
  9. zhs16gbk对应mysql_数据库的编码浅谈(ZHS16GBK与US7ASCII)
  10. 修改对象的某个属性的值_什么是类,什么是对象