7

基于YOLOv5和DeepSort的目标跟踪

 2 years ago
source link: https://xugaoxiang.com/2020/10/17/yolov5-deepsort-pytorch/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

软硬件环境

视频看这里

此处是youtube的播放链接,需要科学上网。喜欢我的视频,请记得订阅我的频道,打开旁边的小铃铛,点赞并分享,感谢您的支持。

YOLOv5

前文 YOLOv5目标检测YOLOv5模型训练 已经介绍过了YOLOv5相关的内容,在目标检测中效果不错。

DeepSort

SORT算法的思路是将目标检测算法(如YOLO)得到的检测框与预测的跟踪框的iou(交并比)输入到匈牙利算法中进行线性分配来关联帧间 ID。而DeepSORT算法则是将目标的外观信息加入到帧间匹配的计算中,这样在目标被遮挡但后续再次出现的情况下,还能正确匹配这个ID,从而减少ID的切换,达到持续跟踪的目的。

项目地址 https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch,使用的是Pytorch深度学习框架,联合YOLOv5DeepSort两个目前很火且效果非常不错的算法工程,实现特定物体的目标跟踪。

git clone https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch.git
cd Yolov5_DeepSort_Pytorch
pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
pip install -r requirements.txt

然后去下载权重文件,YOLOv5的权重文件放置在yolov5/weights文件夹下,DeepSort的权重文件ckpt.t7放置在deep_sort/deep/checkpoint文件夹下

下载链接,百度网盘下载地址, 提取码:u5v3

找个测试视频,来看看效果吧

python track.py --source test.mp4

测试效果图

deepsort


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK