ObjectTracker
如何放置
Python
Python
1pipeline = dai.Pipeline()
2objectTracker = pipeline.create(dai.node.ObjectTracker)输入和输出
零项跟踪
短期跟踪
支持的对象跟踪器类型
SHORT_TERM_KCF:核相关滤波跟踪。KCF 利用循环矩阵的特性来提高处理速度。论文见此处。SHORT_TERM_IMAGELESS:短期跟踪允许在跳过了对象检测的帧上,通过外推先前检测的目标轨迹来跟踪对象。ZERO_TERM_COLOR_HISTOGRAM:利用位置、形状和输入图像信息(如 RGB 直方图)进行对象跟踪。ZERO_TERM_IMAGELESS:仅利用检测对象的矩形形状和位置信息进行对象跟踪,不使用跟踪对象的颜色信息。其吞吐量高于 ZERO_TERM_COLOR_HISTOGRAM。用户在选择对象跟踪器类型时需权衡吞吐量与精度。
最大跟踪对象数量
使用示例
Python
Python
1pipeline = dai.Pipeline()
2objectTracker = pipeline.create(dai.node.ObjectTracker)
3
4objectTracker.setDetectionLabelsToTrack([15]) # 仅跟踪人
5# 可能的跟踪类型:ZERO_TERM_COLOR_HISTOGRAM, ZERO_TERM_IMAGELESS, SHORT_TERM_IMAGELESS, SHORT_TERM_KCF
6objectTracker.setTrackerType(dai.TrackerType.ZERO_TERM_COLOR_HISTOGRAM)
7# 跟踪新对象时采用最小 ID,可选:SMALLEST_ID, UNIQUE_ID
8objectTracker.setTrackerIdAssignmentPolicy(dai.TrackerIdAssignmentPolicy.SMALLEST_ID)
9
10# 必须将对象跟踪器与检测网络以及图像帧源(单目/彩色相机或 xlinkIn 节点)结合使用功能示例
参考
class
depthai.node.ObjectTracker(depthai.Node)
method
setDetectionLabelsToTrack(self, labels: collections.abc.Sequence
[
typing.SupportsInt
])Specify detection labels to track. Parameter ``labels``: Detection labels to track. Default every label is tracked from image detection network output.
method
setMaxObjectsToTrack(self, maxObjectsToTrack: typing.SupportsInt)Specify maximum number of object to track. Parameter ``maxObjectsToTrack``: Maximum number of object to track. Maximum 60 in case of SHORT_TERM_KCF, otherwise 1000.
method
setOcclusionRatioThreshold(self, occlusionRatioThreshold: typing.SupportsFloat)Specify occlusion ratio threshold. Parameter ``occlusionRatioThreshold``: Occlusion ratio threshold. Used to filter out overlapping tracklets. Default 0.4.
method
setTrackerIdAssignmentPolicy(self, type: depthai.TrackerIdAssignmentPolicy)Specify tracker ID assignment policy. Parameter ``type``: Tracker ID assignment policy.
method
setTrackerThreshold(self, threshold: typing.SupportsFloat)Specify tracker threshold. Parameter ``threshold``: Above this threshold the detected objects will be tracked. Default 0, all image detections are tracked.
method
setTrackerType(self, type: depthai.TrackerType)Specify tracker type algorithm. Parameter ``type``: Tracker type.
method
setTrackingPerClass(self, trackingPerClass: bool)Whether tracker should take into consideration class label for tracking.
method
setTrackletBirthThreshold(self, threshold: typing.SupportsInt)Specify tracklet birth threshold. Parameter ``threshold``: Tracklet birth threshold. Minimum consecutive tracked frames required to consider a tracklet as a new instance. Default 3.
method
setTrackletMaxLifespan(self, lifespan: typing.SupportsInt)Specify tracklet lifespan. Parameter ``lifespan``: Tracklet lifespan in number of frames. Number of frames after which a LOST tracklet is removed. Default 120.
property
inputConfig
Input ObjectTrackerConfig message with ability to modify parameters at runtime. Default queue is non-blocking with size 4.
property
inputDetectionFrame
Input ImgFrame message on which object detection was performed. Default queue is non-blocking with size 4.
property
inputDetections
Input message with image detection from neural network. Default queue is non- blocking with size 4.
property
inputTrackerFrame
Input ImgFrame message on which tracking will be performed. RGBp, BGRp, NV12, YUV420p types are supported. Default queue is non-blocking with size 4.
property
out
Outputs Tracklets message that carries object tracking results.
property
passthroughDetectionFrame
Passthrough ImgFrame message on which object detection was performed. Suitable for when input queue is set to non-blocking behavior.
property
passthroughDetections
Passthrough image detections message from neural network output. Suitable for when input queue is set to non-blocking behavior.
property
passthroughTrackerFrame
Passthrough ImgFrame message on which tracking was performed. Suitable for when input queue is set to non-blocking behavior.
需要帮助?
请前往 OAKChina 官网 获取技术支持或解答您的任何疑问。