Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-208

SORT Track Assignment

Problem

Assign detections to tracks with greedy IoU matching and birth new tracks (SORT lite).

Each track is [id, box]. Score all detection-track pairs with IoU >= iou_threshold, sort by descending IoU (ties by detection then track index) and greedily assign unused pairs. Detections left unassigned get new ids starting from max existing id + 1 (or 0 with no tracks). Return the id assigned to each detection.

Test cases

case 1
in: [[[0,[0,0,2,2]]],[[0,0,2,2]],0.5]
expected: [0]
case 2
in: [[[5,[0,0,2,2]]],[[0.1,0.1,2.1,2.1],[10,10,12,12]],0.1]
expected: [5,6]
case 3
in: [[],[[0,0,1,1],[2,2,3,3]],0.5]
expected: [0,1]
case 4
in: [[[0,[0,0,1,1]],[1,[5,5,6,6]]],[[0,0,1,1],[5,5,6,6]],0.5]
expected: [0,1]
Starter codePython
def sort_assign(tracks, detections, iou_threshold):
    # Your code here
    pass

4 test cases · run your code against them in the editor