diff --git a/hailo_model_zoo/core/eval/tracking_evaluation_external/matching.py b/hailo_model_zoo/core/eval/tracking_evaluation_external/matching.py index 59aeac49..4a1a1e8f 100644 --- a/hailo_model_zoo/core/eval/tracking_evaluation_external/matching.py +++ b/hailo_model_zoo/core/eval/tracking_evaluation_external/matching.py @@ -1,4 +1,4 @@ -import lap +from scipy.optimize import linear_sum_assignment import numpy as np import scipy from scipy.spatial.distance import cdist @@ -39,7 +39,8 @@ def linear_assignment(cost_matrix, thresh): if cost_matrix.size == 0: return np.empty((0, 2), dtype=int), tuple(range(cost_matrix.shape[0])), tuple(range(cost_matrix.shape[1])) matches, unmatched_a, unmatched_b = [], [], [] - cost, x, y = lap.lapjv(cost_matrix, extend_cost=True, cost_limit=thresh) + x, y = linear_sum_assignment(cost_matrix) + cost = cost_matrix[x, y].sum() for ix, mx in enumerate(x): if mx >= 0: matches.append([ix, mx]) diff --git a/hailo_model_zoo/core/eval/tracking_evaluation_external/mot_evaluator.py b/hailo_model_zoo/core/eval/tracking_evaluation_external/mot_evaluator.py index 9d022e48..55dd1cd3 100644 --- a/hailo_model_zoo/core/eval/tracking_evaluation_external/mot_evaluator.py +++ b/hailo_model_zoo/core/eval/tracking_evaluation_external/mot_evaluator.py @@ -3,7 +3,7 @@ import motmetrics as mm import numpy as np -mm.lap.default_solver = "lap" +mm.lap.default_solver = "scipy.optimize" class Evaluator(object): @@ -22,7 +22,7 @@ def eval_frame(self, gt_tlwhs, gt_ids, ignore_tlwhs, trk_tlwhs, trk_ids, rtn_eve keep = np.ones(len(trk_tlwhs), dtype=bool) iou_distance = mm.distances.iou_matrix(ignore_tlwhs, trk_tlwhs, max_iou=0.5) if len(iou_distance) > 0: - match_is, match_js = mm.lap.linear_sum_assignment(iou_distance) + match_is, match_js = linear_sum_assignment(iou_distance) match_is, match_js = (np.asarray(a, dtype=int) for a in [match_is, match_js]) match_ious = iou_distance[match_is, match_js] diff --git a/hailo_model_zoo/core/postprocessing/cython_utils/cython_nms.pyx b/hailo_model_zoo/core/postprocessing/cython_utils/cython_nms.pyx index e4efd8fe..29e33a86 100644 --- a/hailo_model_zoo/core/postprocessing/cython_utils/cython_nms.pyx +++ b/hailo_model_zoo/core/postprocessing/cython_utils/cython_nms.pyx @@ -25,7 +25,7 @@ def nms(np.ndarray[np.float32_t, ndim=2] dets, np.float32_t thresh): cdef np.ndarray[np.int64_t, ndim=1] order = scores.argsort()[::-1] cdef int ndets = dets.shape[0] - cdef np.ndarray[np.int_t, ndim=1] suppressed = \ + cdef np.ndarray[np.int32_t, ndim=1] suppressed = \ np.zeros((ndets), dtype=int) # nominal indices diff --git a/setup.py b/setup.py index 4a80f1a2..df4cc642 100755 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ def main(): reqs = [ "numba", - "imageio==2.9.0", + "imageio>=2.9.0", "matplotlib", "numpy", "opencv-python", @@ -48,13 +48,12 @@ def main(): "termcolor", "tqdm", "pycocotools", - "lap==0.4.0", - "motmetrics==1.2.5", - "omegaconf==2.3.0", - "pillow<=9.2.0", - "detection-tools==0.3", - "scikit-image==0.19.3", - "nuscenes-devkit==1.1.10", + "motmetrics>=1.2.5", + "omegaconf>=2.3.0", + "pillow>=9.2.0", + "detection-tools>=0.3", + "scikit-image>=0.19.3", + "nuscenes-devkit>=1.1.10", ] model_zoo_version = "2.13.0"