YOLOv5+Deepsort的环境配置

本文介绍如何下载并配置YOLOv5和DeepSort的最新版本,包括权重文件的下载、虚拟环境的搭建、PyTorch版本更新、requirements.txt安装及视频跟踪实战。遇到OpenMP问题时,提供了解决方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

首先在https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch下载YOLOv5+Deepsort的v2版本也可以v3版本,这里就v2版本演示,
此处https://github.com/ultralytics/yolov5/tree/v5.0下载YOLOV5的v5版本。
注意:版本要相互匹配。
在这里插入图片描述
在这里插入图片描述
下载权重文件
将网盘中YOLOv5的权重文件放置在yolov5/weights文件夹下,DeepSort的权重文件ckpt.t7放置在deep_sort/deep/checkpoint文件夹下

链接:https://pan.baidu.com/share/init?surl=5c0i-EQuKiTXrOGp3ShxvQ
提取码:u5v3

使用anaconda建立一个DeepSort虚拟环境:

conda create -n DeepSort python=3.8
conda activate DeepSort

安装pytorch1.7和cuda10.2
由于更新了yolov5,因此,pytorch的版本也需要更新到1.7以上,我这里匹配的是cuda 10.2。

pip install torch==1.7.1+cu101 torchvision==0.8.2+cu101 torchaudio==0.7.2 -f https://download.pytorch.org/whl/torch_stable.html

在pycharm中安装requirements.txt文件。

pip install -r requirements.txt

在requirements.txt中opencv-python可能安装不上。可以直接在pycharm终端上安装。

pip install opencv-python

之后需要测试视频:
下载链接:https://pan.baidu.com/s/1VOVy0kcXvwDX03QE56JmEw
提取码:pd63

在pycharm终端上运行
python3 track.py --source (test.mp4测试视频名字) --show-vid

文件类型不同,命令不同:
Video: --source file.mp4 # python track.py --source=“011.mp4” --show-vid
Webcam: --source 0
RTSP stream: --source rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa
HTTP stream: --source http://wmccpinetop.axiscam.net/mjpg/video.mjpg

可能还会报一个错误:
Hint: This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.

解决方法:
在track.py文件中加入下列代码:

import os
 
os.environ['KMP_DUPLICATE_LIB_OK']='True'

再运行代码。就成功了

评论 25
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

..Severus

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值