【发布时间】:2020-11-07 11:24:09
【问题描述】:
我一直在尝试将 Faster R-CNN 对象检测模型与深度排序跟踪算法相结合。但是,由于某种原因,跟踪算法表现不佳,这意味着同一个人的跟踪 ID 只会不断增加。
我已使用此存储库来构建我自己的脚本。 (查看 demo.py)deep-sort yolov3
我做了什么:
-
每 30 帧检测一次
-
为检测分数创建了一个列表
-
为检测边界框创建了一个列表(考虑深度排序的输入格式)
-
调用跟踪器!!!
# tracking and draw bounding boxes for i in range(0, len(refine_person_detection)): confidence_worker.append(refine_person_detection[i][4]) # scores bboxes.append([refine_person_detection[i][0], refine_person_detection[i][2], (refine_person_detection[i][1] - refine_person_detection[i][0]), (refine_person_detection[i][3] - refine_person_detection[i][2])]) # bounding boxes features = encoder(frame, bboxes) detections = [Detection(bbox, confidence, feature) for bbox, confidence, feature in zip(bboxes, confidence_worker, features)] boxes = np.array([d.tlwh for d in detections]) scores = np.array([d.confidence for d in detections]) indices = preprocessing.non_max_suppression(boxes, nms_max_overlap, scores) detections = [detections[i] for i in indices] tracker.predict() # calling the tracker tracker.update(detections) for track in tracker.tracks: k.append(track) if not track.is_confirmed() or track.time_since_update > 1: continue bbox = track.to_tlbr() cv2.rectangle(frame, (int(bbox[0]), int(bbox[1])), (int(bbox[2]), int(bbox[3])), (255, 255, 255), 2) cv2.putText(frame, str(track.track_id), (int(bbox[0]), int(bbox[1])), 0, 5e-3 * 200, (0, 255, 0), 2)
提前感谢您的任何建议
【问题讨论】:
标签: tracking object-detection-api faster-rcnn