Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-202

Tracking IoU Association

Problem

Associate detections to existing tracks by IoU.

Process detections in order and, for each, pick the unused track with the highest IoU. Assign that track index when the best IoU is at least threshold, otherwise output -1. Return one value per detection.

Test cases

case 1
in: [[[0,0,2,2],[10,10,12,12]],[[0,0,2,2],[10,10,12,12]],0.5]
expected: [0,1]
case 2
in: [[[0,0,2,2],[10,10,12,12]],[[1,1,3,3],[10,10,12,12]],0.1]
expected: [0,1]
case 3
in: [[[0,0,2,2],[10,10,12,12]],[[1,1,3,3],[10,10,12,12]],0.5]
expected: [-1,1]
case 4
in: [[[0,0,2,2]],[],0.5]
expected: []
Starter codePython
def associate_tracks(tracks, detections, threshold):
    # Your code here
    pass

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