目标跟踪检测DeepSort 与yolov5目标检测部署实践

目标跟踪检测DeepSort 与yolov5目标检测部署实践,第1张

目标跟踪检测算法DeepSort在window server 2012R 运行配置部署 1 . 环境部署及报错误区 1) 环境
  1. pycharm 2022
  2. python 3.8
  3. 2012R server
  4. 项目代码文件 https://github.com/mikel-brostrom/Yolov5_DeepSort_OSNet.git

  1. 文件夹 torchreid (https://github.com/KaiyangZhou/deep-person-reid.git)

    整理一下,目录结构大致是这样的

    安装包,配置国内源比较快一点,我用的是清华源,至此基本完成项目配置

pip install -r requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple/

小结:

pycharm 建立项目要熟练的使用,不然要搞的晕头转向,还有环境的切换,个人简易可以随便拉个python项目用conda下载包,换源,卸载包,这类的 *** 作熟练,反正我就好烦,我电脑直接盘不够用,直接搞服务器了,

2)远程桌面连接

win+‘空格’ 输入远程桌面连接,进入

from .cv2 import * DLL laod failed 找不到指定模块

原因:缺少相关库文件;

在网上检索了一下,目前有几种解决:

  1. 安装 visual studio c++;
  2. 下载相关的DLL 包,然后激活;
  3. CV2 与python 版本不匹配,下载相应的cv2 包对应相同的版本
  4. 综上,我都没有成功,2021R server服务器报错,以下是我的解决方案:

用户界面和基础结构这下面三个全选中,然后等待安装,安装完成后会重启服务器,再次连接就行了,安装时间一般为5-10 分钟

3)缺少权重文件,

这个需要到谷歌盘下载,不翻墙是下载不了的,下载不了是运行不了的,是在搞不到的需要的可以私聊我,

2. 运行调试

运行参数就这些,调整这些运行参数,来完成相应的功能

官方文档的用法,参考下,

Tracking can be run on most video formats

$ python track.py --source 0  # webcam
                           img.jpg  # image
                           vid.mp4  # video
                           path/  # directory
                           path/*.jpg  # glob
                           'https://youtu.be/Zgi9g1ksQHc'  # YouTube
                           'rtsp://example.com/media.mp4'  # RTSP, RTMP, HTTP stream
Yolov5

There is a clear trade-off between model inference speed and accuracy. In order to make it possible to fulfill your inference speed/accuracy needs you can select a Yolov5 family model for automatic download

$ python track.py --source 0 --yolo_model yolov5n.pt --img 640
                                          yolov5s.pt
                                          yolov5m.pt
                                          yolov5l.pt 
                                          yolov5x.pt --img 1280
                                          ...
DeepSort

The above applies to DeepSort models as well. Choose a ReID model based on your needs from this ReID model zoo

$ python track.py --source 0 --deep_sort_model osnet_x0_25_market1501
                                               osnet_x0_5_market1501
                                               osnet_x0_75_msmt17
                                               osnet_x1_0_msmt17
                                               ...
Filter tracked classes

By default the tracker tracks all MS COCO classes.

If you only want to track persons I recommend you to get these weights for increased performance

python3 track.py --source 0 --yolo_model yolov5/weights/crowdhuman_yolov5m.pt --classes 0  # tracks persons, only

If you want to track a subset of the MS COCO classes, add their corresponding index after the classes flag

python3 track.py --source 0 --yolo_model yolov5s.pt --classes 16 17  # tracks cats and dogs, only

Here is a list of all the possible objects that a Yolov5 model trained on MS COCO can detect. Notice that the indexing for the classes in this repo starts at zero.

MOT compliant results

Can be saved to your experiment folder runs/track/_/ by

python3 track.py --source ... --save-txt
在命令行使用报错, 可以使用pycharm 配置运行

按照参考文档的方法进行使用,

最后演示结果

目标跟踪

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/801696.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-07
下一篇 2022-05-07

发表评论

登录后才能评论

评论列表(0条)

保存