MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / compute_lap

Function compute_lap

PATH/core/solvers/utils/peddet_tester_dev.py:802–837  ·  view source on GitHub ↗
(dtboxes, gtboxes, thr)

Source from the content-addressed store, hash-verified

800 return ious
801
802def compute_lap(dtboxes, gtboxes, thr):
803
804 eps = 1e-7
805 n, k = dtboxes.shape[0], gtboxes.shape[0]
806 if k + n < 2:
807 m, n = np.array([]), np.array([])
808 return m, n
809
810 overlaps = compute_iou_matrix(dtboxes, gtboxes)
811
812 if n < 2:
813 cols = np.argmax(overlaps, axis = 1)
814 rows = np.array([0])
815 m, n = (rows, cols) if thr - overlaps[rows, cols] < eps else (np.array([]), np.array([]))
816 return m, n
817
818 if k < 2:
819
820 rows = np.argmax(overlaps, axis = 0)
821 cols = np.array([0])
822 m,n = (rows, cols) if thr - overlaps[rows, cols] < eps else (np.array([]), np.array([]))
823 return m, n
824
825 ious = overlaps * (overlaps >= thr)
826
827 matches = minimumWeightMatching(-ious)
828 m, n = np.array([i for i, _ in matches]).astype(np.int32), np.array([i for _, i in matches]).astype(np.int32)
829 indice = np.where(overlaps[m, n] < thr)[0]
830
831 if indice.size >= m.size:
832 m, n = np.array([]), np.array([])
833 else:
834 index = np.array(list(set(np.arange(m.size)) - set(indice))).astype(np.int)
835 m, n = m[index], n[index]
836
837 return m, n
838
839def minimumWeightMatching(costSet : np.ndarray) -> list:
840 ''&#x27;

Callers 1

compute_JCFunction · 0.85

Calls 2

compute_iou_matrixFunction · 0.85
minimumWeightMatchingFunction · 0.85

Tested by

no test coverage detected