Yolov5进阶之七目标追踪最新环境搭建

前面介绍了deepsort3.0 +yolo5.0 目标追踪环境搭建流程,为了适应更新的pt环境,开始尝试使用更yolo6.0以上版本来实现deepsort。新的版本大多需要科学上网完成,大家知悉。deepsort及其适用说明见https://github.com/mikel-brostrom/Yolov5_StrongSORT_OSNet/blob/master/README.md
先建立环境,使用3.8 或者以上版本,

conda create --prefix=D:/PycharmProjects/DeepsortNew/DeepsortNew_env python=3.8

安装pytorch

pip install torch==1.8.0+cu111 torchvision==0.9.0+cu111 torchaudio==0.8.0 -f https://download.pytorch.org/whl/torch_stable.html

将Yolov5_StrongSORT_OSNet-master(6.0之后的版本,还没有release)放入与env平行的文件夹,然后将yolov5-6.1(写这篇文章时还是master 没有release)改名yolov放在Yolov5_StrongSORT_OSNet-6.0文件夹下。分别进入 yolov5和Yolov5_StrongSORT_OSNet-master执行

pip install -r requirements.txt

安装依赖。之后调试yolov5
执行

python track.py --source 0

提示
ModuleNotFoundError: No module named ‘torchreid’
执行下面命令安装模块

pip install https://github.com/KaiyangZhou/deep-person-reid/archive/master.zip

再次测试yolov5 track
执行会提示
No URL associated to the chosen DeepSort weights. Choose between:
Available ReID models for automatic download
按照 github readme执行以下代码(科学上网)

python track.py --source 0 --strong-sort-weights osnet_x0_25_market1501.pt

发现还是 HTTPS错误,如果你用的时HTTPS代理就成功了。根据提示可知可以自动下载的pt 包括
resnet50_market1501.pt’, ‘resnet50_dukemtmcreid.pt’, ‘resnet50_msmt17.pt’, ‘resnet50_fc512_market1501.pt’, ‘resnet50_fc512_dukemtmcreid.pt’, ‘resnet50_fc512_msmt17.pt’, ‘mlfn_market1501.pt’, ‘mlfn_dukemtmcreid.pt’, ‘mlfn_msmt17.pt’, ‘hacnn_market1501.pt’, ‘hacnn_dukemtmcreid.pt’, ‘hacnn_msmt17.pt’, ‘mobilenetv2_x1_0_market1501.pt’, ‘mobilenetv2_x1_0_dukemtmcreid.pt’, ‘mobilenetv2_x1_0_msmt17.pt’, ‘mobilenetv2_x1_4_market1501.pt’, ‘mobilenetv2_x1_4_dukemtmcreid.pt’, ‘mobilenetv2_x1_4_msmt17.pt’, ‘osnet_x1_0_market1501.pt’, ‘osnet_x1_0_dukemtmcreid.pt’, ‘osnet_x1_0_msmt17.pt’, ‘osnet_x0_75_market1501.pt’, ‘osnet_x0_75_dukemtmcreid.pt’, ‘osnet_x0_75_msmt17.pt’, ‘osnet_x0_5_market1501.pt’, ‘osnet_x0_5_dukemtmcreid.pt’, ‘osnet_x0_5_msmt17.pt’, ‘osnet_x0_25_market1501.pt’, ‘osnet_x0_25_dukemtmcreid.pt’, ‘osnet_x0_25_msmt17.pt’, ‘osnet_ibn_x1_0_msmt17.pt’, 'osnet_ain_x1_0_msmt17.pt

选用
python track.py --source 0 --strong-sort-weight osnet_x0_75_msmt17.pt
成功。需要科学上网,启动识别后可断开
注意,如果过程中提示缺少
osnet_x0_75_imagenet.pth
将此文件 复制到C:\Users\XXXX.cache\torch\checkpoints即可,文件下载路径
该文件下载地址
https://download.csdn.net/download/buaaweibin/85840631

建议还是适用deepsort3.0 + yolov5 5.0 比较方便。

你可能感兴趣的:(图像处理,开源系统,python,深度学习,开发语言)