目标跟踪检测算法DeepSort在window server 2012R 运行配置部署
目录
1.代码环境搭建
2. 报错解决方案
3. 运行调试
4. 演示演示结果
1 .代码环境搭建
- pycharm 2022
- python 3.8
- 2012R server
- 项目代码文件 https://github.com/mikel-brostrom/Yolov5_DeepSort_OSNet.git
-
文件夹 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. 报错解决方案
1. from .cv2 import * DLL laod failed 找不到指定模块
原因:缺少相关库文件;
在网上检索了一下,目前有几种解决:
- 安装 visual studio c++;
- 下载相关的DLL 包,然后激活;
- CV2 与python 版本不匹配,下载相应的cv2 包对应相同的版本
- 综上,我都没有成功,2021R server服务器报错,以下是我的解决方案:
用户界面和基础结构这下面三个全选中,然后等待安装,安装完成后会重启服务器,再次连接就行了,安装时间一般为5-10 分钟
2.)目标主机无法连接,缺少权重文件.
这个需要到谷歌盘下载,不翻墙是下载不了的,下载不了是运行不了的,这个是权重的分享链接
这个是分享的链接
链接:https://pan.baidu.com/s/1jGcxCNi4agTdVz-IkN_UIA
提取码:1111
…
3. 运行调试
运行参数就这些,调整这些运行参数,来完成相应的功能
官方文档的用法,参考下,
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
1. 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
...
2. 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
...
3. 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.
4. MOT compliant results
Can be saved to your experiment folder runs/track/<yolo_model>_<deep_sort_model>/
by
python3 track.py --source ... --save-txt
5. 在命令行使用报错,可以使用pycharm 配置运行
按照参考文档的方法进行使用,
4. 最后演示结果
目标跟踪