栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

YOLOv5+Deepsort的环境配置

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

YOLOv5+Deepsort的环境配置

首先在https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch下载YOLOv5+Deepsort的v2版本也可以v3版本,这里就v2版本演示,
此处https://github.com/ultralytics/yolov5/tree/v5.0下载YOLOV5的v5版本。
注意:版本要符合YOLOv5+Deepsort v2和Yolov5中v5版本相配适,YOLOv5+Deepsort v3和YoloV5中v6版本相配适


下载权重文件
将网盘中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'

再运行代码。就成功了

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/461114.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号