【发布时间】:2019-11-09 21:09:45
【问题描述】:
早安,
我使用 YOLOv3 模型来检测场景中仅出现人类对象。基本上,YOLO 模型尝试在每一帧中检测人体对象,尽管它看起来像是在跟踪,因为边界框是不断移动的。
我正在寻找一种可行的方法来跟踪每个检测到的人体对象,方法是为每个对象分配一个标识符。 (请参阅提供的图片)
以下代码用于绘制基于left、top、right、bottom的边界框,这意味着x、width、y、height。我可以为每个检测到的人体对象分配一个标识符吗?
例如将 ID_1 分配给检测到的“person:0.73”,将 ID_2 分配给“person:1.00”
非常感谢您的帮助和时间,谢谢。
尝试为每个检测到的人分配一个标识符
def drawPred(classId, conf, left, top, right, bottom):
# 画一个边界框。
cv2.rectangle(resized_frame, (left, top), (right, bottom), (255,0,255), 5)
label = '%.2f' % conf
# Get the label for the class name and its confidence
if classes:
assert(classId < len(classes))
label = '%s:%s' % (classes[classId], label)
#Display the label at the top of the bounding box
labelSize, baseLine = cv2.getTextSize(label, cv2.FONT_HERSHEY_SIMPLEX, 0.5, 1)
top = max(top, labelSize[1]) - 5
cv2.putText(resized_frame, label, (left, top), cv2.FONT_HERSHEY_SIMPLEX, 1, (0,255,255), 2)
【问题讨论】:
-
对于跟踪,您可以使用卡尔曼滤波器,如 here。他在每 10 帧后执行检测,并在其间使用跟踪,这与每帧的检测效果一样好。
-
使用排序跟踪器:github.com/abewley/sort