Multi Object Trackers基于 Python 的多对象跟踪器
Multi Object Trackers 是一个基于 Python,易于使用的各种多对象跟踪算法的实现。
可用的多对象跟踪器
CentroidTracker
IOUTracker
CentroidKF_Tracker
SORT
可用的基于 OpenCV 的物体检测器:
detector.TF_SSDMobileNetV2
detector.Caffe_SSDMobileNet
detector.YOLOv3
安装
OpenCV(版本 3.4.3 或更高版本)的 Pip install 可以使用以下命令完成:
git clone https://github.com/adipandas/multi-object-tracker
cd multi-object-tracker
pip install -r requirements.txt
pip install -e .
如何使用?
每个跟踪器的界面都很简单而相似,可参考下面的示例模板:
from motrackers import CentroidTracker # or IOUTracker, CentroidKF_Tracker, SORT
input_data = ...
detector = ...
tracker = CentroidTracker(...) # or IOUTracker(...), CentroidKF_Tracker(...), SORT(...)
while True:
done, image =
if done:
break
detection_bboxes, detection_confidences, detection_class_ids = detector.detect(image)
# NOTE:
# * `detection_bboxes` are numpy.ndarray of shape (n, 4) with each row containing (bb_left, bb_top, bb_width, bb_height)
# * `detection_confidences` are numpy.ndarray of shape (n,);
# * `detection_class_ids` are numpy.ndarray of shape (n,).
output_tracks = tracker.update(detection_bboxes, detection_confidences, detection_class_ids)
# `output_tracks` is a list with each element containing tuple of
# (,
,
,
,
,
,
,
,
,
) for track in output_tracks: frame, id, bb_left, bb_top, bb_width, bb_height, confidence, x, y, z = track assert len(track) == 10 print(track)
(input_data)>
(input_data)>
有关更多详细信息,请参阅此存储库的示例文件夹。您可以克隆和运行示例。
评论