主要内容

Multiple Object Tracking

追踪is the process of locating a moving object or multiple objects over time in a video stream. Tracking an object is not the same as object detection. Object detection is the process of locating an object of interest in a single frame. Tracking associates detections of an object across multiple frames.

跟踪μltiple objects requires detection, prediction, and data association.

  • Detection: Detect objects of interest in a video frame.

  • Prediction: Predict the object locations in the next frame.

  • 数据关联:使用预测的位置将跨帧的检测相关联追踪s

Detection

Selecting the right approach for detecting objects of interest depends on what you want to track and whether the camera is stationary.

Detect Objects Using a Stationary Camera

要使用固定摄像机检测运动中的对象,您可以使用vision.ForegroundDetector系统对象。这background subtraction approach works efficiently but requires the camera to be stationary.

使用移动相机检测对象

为了通过移动摄像头检测运动对象,您可以使用滑动窗口检测方法。这种方法通常比背景减法方法更慢。要检测和跟踪对象的特定类别,请使用表中描述的系统对象或功能。

Select A Detection Algorithm

跟踪对象的类型 Camera 功能
任何移动的东西 Stationary

vision.ForegroundDetector系统对象™

脸,眼睛,鼻子,嘴,上半身 Stationary, Moving

Vision.CascadeObjectDetector系统对象

Pedestrians Stationary, Moving

vision.PeopleDetector系统对象

自定义对象类别 Stationary, Moving

trainCascadeObjectDetector功能
或者
custom sliding window detector usingextractHOGFeaturesselectStrongestBbox

Prediction

To track an object over time means that you must predict its location in the next frame. The simplest method of prediction is to assume that the object will be near its last known location. In other words, the previous detection serves as the next prediction. This method is especially effective for high frame rates. However, using this prediction method can fail when objects move at varying speeds, or when the frame rate is low relative to the speed of the object in motion.

A more sophisticated method of prediction is to use the previously observed motion of the object. The Kalman filter (vision.KalmanFilter) predicts the next location of an object, assuming that it moves according to a motion model, such as constant velocity or constant acceleration. The Kalman filter also takes into account process noise and measurement noise.过程噪声是对象与运动模型的实际运动的偏差。Measurement noise是检测错误。

要使配置Kalman过滤器更容易,请使用configurekalmanfilter。此函数设置了用于跟踪物理对象在笛卡尔坐标系中以恒定速度或恒定加速度移动的物理对象的过滤器。统计数据沿所有维度相同。如果您需要配置具有不同假设的Kalman过滤器,则需要构造vision.KalmanFilterobject directly.

Data Association

数据关联是关联检测与对应于相同物理对象的检测过程。特定对象的时间历史由多个检测组成,称为追踪。A track representation can include the entire history of the previous locations of the object. Alternatively, it can consist only of the object's last known location and its current velocity.

检测跟踪成本函数

要将检测与轨道匹配,您必须建立评估比赛的标准。通常,您通过定义成本函数来建立此标准。将检测与轨道匹配的成本越高,检测属于轨道的可能性就越小。一个简单的成本函数可以定义为预测对象和检测到的对象的边界框之间的重叠程度。这跟踪行人的行人示例使用bboxoverlapratio功能。您可以实现更复杂的成本函数,该功能是指出预测不确定性的一种distance功能of thevision.KalmanFilter目的。您还可以实现自定义成本功能,而不是合并有关对象大小和外观的信息。

Elimination of Unlikely Matches

Gating是一种从考虑因素中消除极不可能匹配的方法,例如通过对成本函数施加阈值。如果成本超过一定的阈值,则观察结果不能与轨道匹配。使用此阈值方法有效地导致圆形门控区域around each prediction, where a matching detection can be found. An alternative gating technique is to make the gating region large enough to include thek- 预测的最邻居。

分配检测到跟踪

数据关联减少到最小重量双分匹配问题,这是图理论的一个良好的领域。两分图表示轨道和检测为顶点。它还代表匹配检测和轨道作为相应顶点之间的加权边缘的成本。

sigsDetectionStotracks功能implements the Munkres' variant of the Hungarian bipartite matching algorithm. Its input is thecost matrix, where the rows correspond to tracks and the columns correspond to detections. Each entry contains the cost of assigning a particular detection to a particular track. You can implement gating by setting the cost of impossible matches to infinity.

Track Management

数据关联must take into account the fact that new objects can appear in the field of view, or that an object being tracked can leave the field of view. In other words, in any given frame, some number of new tracks might need to be created, and some number of existing tracks might need to be discarded. ThesigsDetectionStotracks功能returns the indices of unassigned tracks and unassigned detections in addition to the matched pairs.

处理无与伦比的探测方法的一种方法是从它们中创建一个新曲目。另外,您可以从大于一定尺寸的无与伦比的检测或具有某些位置或外观的检测中创建新曲目。例如,如果场景具有单个入口点,例如门口,则可以指定仅位于入口点附近的无与伦比的检测可以开始新的轨道,并且所有其他检测都被视为噪声。

Another way of handling unmatched tracks is to delete any track that remain unmatched for a certain number of frames. Alternatively, you can specify to delete an unmatched track when its last known location is near an exit point.

See Also

||||||||||

Related Examples

More About

外部网站