current position:Home>Target tracking actual combat deepsort+yolov5 (on)

Target tracking actual combat deepsort+yolov5 (on)

2022-08-06 18:09:39the_way_inf

携手创作,共同成长!这是我参与「掘金日新计划 · 8 月更文挑战」的第4天,点击查看活动详情 >>


The main purpose of today is to quickly get started with target tracking,In the previous words, I briefly talked about the Kalman filter,Then due to blogging issues,Not finished.I wanted to do a series,But it's hard to sort out,And to be honest, there are some things I don't understand.当然这并不影响我们使用,Abstract to continuehappy,Like you don't understandSpringBoot 或者Django底层一样,Still wide enough to make a website.


First of all, what we are talking about here is actually the whole project,是两个部分,One is the tracking part of the target,There is also the recognition and detection part of the target.We need to detect an item first,We can follow,At the same time, this algorithm is also based on the target detection algorithm.

The relationship between them is like this:

在这里插入图片描述 Then there is not much to say about target detection here.

You can refer to these blog posts:

GitHub 水项目之 快速上手 YOLOV5

YOLOV5 参数设定与模型训练的坑点一二三

YOLOV1Small finishing of the thesis and this blog post: Teach you how to make your own target detection framework(从理论到实现)

So we are mainly heredeepsort的一个情况.


Speaking of this stuff, I have to talk about it firstsort算法.

Earlier when talking about the list tracking,我们说到了卡尔曼滤波 But this just solves a problem,It is the position where we predict that the next box of the modified object may exist,After that we calculate someIOUMake sure that this next box is our target object,So as to determine his trajectory to complete the target tracking.

But what we assumed earlier was a single-objective case,If it is multi-target,It also involves the question of how to assign a tracked target.That is, give the target a different label,Then recognize after predicting his trajectory,Determine which target this trajectory is for.

所以这个sortThe algorithm actually has two parts,That is, in order to complete one of our target tracking.

一个是匈牙利算法,The purpose is to determine who is who,One is that Kalman tracks in order to predict a state of the object.



deepsort 是在sortA lot of other work is done on the basis of the algorithm.

由于sortThe algorithm is still a rough tracking algorithm,When an object is occluded,Especially easy to lose your ownID.而Deepsort算法在sort算法的基础上增加了级联匹配(MatchingCascade)和新轨迹的确认(confirmed).TracksDivided into confirmation state(confirmed),and indeterminate state(unconfirmed),新产生的Tracksis indeterminate:UnconfirmedTracks必须要和DetectionsMatch a certain number of times in a row(默认是3)can be converted into a confirmed state.ConfirmedTracks必须和DetectionsiA certain number of consecutive mismatches(默认30次),才会被删除.

Then his algorithm flow is probably like this: (Know the picture of the big guy) 在这里插入图片描述


Our words here today,Let's do a brief introduction first,After that, let's be like beforeyoloSame as how to train your own model,Then complete one of your needs.


We focus on seeing this firstdeep_sort 在这里插入图片描述 Here I first give a description of these parameters.

(1)It contains the directory path of the feature extraction weights;








Then we will open it laterdeepsort文件夹,You can see these things:

在这里插入图片描述 里面还是有sort算法的.

ckpt.t7:This is the weights file for a feature extraction network,This weight file will be generated after the feature extraction network is trained,It is convenient to extract features in the target frame during target tracking,Avoid while target trackingID交换. feature extraction model accuracy.提取对应boundingbox中的特征, Get a fixed-dimensional feature,作为该bounding box的代表,供计算相似度时使用. extraction network model,The model is used to extract training features to extract network weights. the feature extraction networkpython文件 the performance of the trained feature extraction network

then in additionsortThe algorithm corresponds to this thing 在这里插入图片描述 a detection box detected by the target,As well as the confidence of the box and the acquired features;At the same time, the conversion methods of various formats of the frame are also provided. between two boxesIOU. code for Kalman filter,It mainly uses Kalman filtering to predict the trajectory information of the detection frame. Hungarian algorithm is used to match the predicted trajectory box and the detection box for the best matching effect. calculating the Euclidean distance、Cosine distance equidistant to calculate the nearest collar distance. suppression code,Use the non-maximum suppression algorithm to output the optimal detection frame. main storage is track information,This includes the position and velocity information of the track box,track boxID和状态,There are three states,One is deterministic、不确定态、Delete state three states. track information is saved,Responsible for initializing the first frame,卡尔曼滤波的预测和更新,负责级联匹配,IOU匹配.

So go back to our root directory: 在这里插入图片描述

deep_sort/deep_sort/ overall package,实现一个deepsortAn overall effect of tracking.

deep_sort/utils:Mainly there are some various tools herepython代码,For example the frame tool,Log saving tools and more.针对读取的视频进行目标追踪封装的一个目标检测器,对视频中的物体进行检测封装了一个目标追踪器,对检测的物体进行追踪

最后来看看效果演示 请添加图片描述

copyright notice
author[the_way_inf],Please bring the original link to reprint, thank you.

Random recommended