From e19d53faef86b4303ab2a181f83610feace6ec6f Mon Sep 17 00:00:00 2001 From: "Keenan D. Buckley" Date: Mon, 20 Jan 2025 11:51:05 -0700 Subject: [PATCH] Fix scoping of assoc_func in OCSort.cpp and make it useful Fix scoping for assoc_func, and replace usages of giou_batch with assoc_func to make it actually useful for changing how the code associates tracks and detections. A more in-depth change to the associate function in Association.hpp might be also needed, but would require refactoring the function's arguments and I didn't want to make a breaking change. --- deploy/OCSort/cpp/src/OCSort.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy/OCSort/cpp/src/OCSort.cpp b/deploy/OCSort/cpp/src/OCSort.cpp index 334c152..9a7ab9d 100644 --- a/deploy/OCSort/cpp/src/OCSort.cpp +++ b/deploy/OCSort/cpp/src/OCSort.cpp @@ -26,7 +26,7 @@ namespace ocsort { {"iou", iou_batch}, { "giou", giou_batch }}; ; - std::function asso_func = ASSO_FUNCS[asso_func_]; + asso_func = ASSO_FUNCS[asso_func_]; inertia = inertia_; use_byte = use_byte_; KalmanBoxTracker::count = 0; @@ -92,7 +92,7 @@ namespace ocsort { for (auto i : unmatched_trks) { u_trks.row(index_for_u_trks++) = trks.row(i); } - Eigen::MatrixXf iou_left = giou_batch(dets_second, u_trks); + Eigen::MatrixXf iou_left = asso_func(dets_second, u_trks); if (iou_left.maxCoeff() > iou_threshold) { std::vector> iou_matrix(iou_left.rows(), std::vector(iou_left.cols())); for (int i = 0; i < iou_left.rows(); i++) { @@ -143,7 +143,7 @@ namespace ocsort { for (auto i : unmatched_trks) { left_trks.row(indx_for_trk++) = last_boxes.row(i); } - Eigen::MatrixXf iou_left = giou_batch(left_dets, left_trks); + Eigen::MatrixXf iou_left = asso_func(left_dets, left_trks); if (iou_left.maxCoeff() > iou_threshold) { std::vector> iou_matrix(iou_left.rows(), std::vector(iou_left.cols())); for (int i = 0; i < iou_left.rows(); i++) { @@ -222,4 +222,4 @@ namespace ocsort { } return ret; } -}// namespace ocsort \ No newline at end of file +}// namespace ocsort