MCPcopy Create free account
hub / github.com/FoundationVision/ByteTrack / iou_distance

Function iou_distance

tutorials/centertrack/mot_online/matching.py:84–102  ·  view source on GitHub ↗

Compute cost based on IoU :type atracks: list[STrack] :type btracks: list[STrack] :rtype cost_matrix np.ndarray

(atracks, btracks)

Source from the content-addressed store, hash-verified

82
83
84def iou_distance(atracks, btracks):
85 """
86 Compute cost based on IoU
87 :type atracks: list[STrack]
88 :type btracks: list[STrack]
89
90 :rtype cost_matrix np.ndarray
91 """
92
93 if (len(atracks)>0 and isinstance(atracks[0], np.ndarray)) or (len(btracks) > 0 and isinstance(btracks[0], np.ndarray)):
94 atlbrs = atracks
95 btlbrs = btracks
96 else:
97 atlbrs = [track.tlbr for track in atracks]
98 btlbrs = [track.tlbr for track in btracks]
99 _ious = ious(atlbrs, btlbrs)
100 cost_matrix = 1 - _ious
101
102 return cost_matrix
103
104def embedding_distance(tracks, detections, metric='cosine'):
105 """

Callers

nothing calls this directly

Calls 1

iousFunction · 0.70

Tested by

no test coverage detected