Skip to content
DeepForgeby svx
All problems
MediumComputer Visioncv-363

Consecutive Frame IoU

Problem

Measure bounding box IoU between consecutive frames of one track.

Given boxes [x1, y1, x2, y2] in frame order, return the IoU of each adjacent pair rounded to 4 decimal places. A track with fewer than two boxes returns [].

Hint

The output has exactly one fewer entry than the input track.

Test cases

case 1
in: [[[0,0,2,2],[0,0,2,2]]]
expected: [1]
case 2
in: [[[0,0,2,2],[4,4,6,6]]]
expected: [0]
case 3
in: [[[0,0,2,2],[1,0,3,2]]]
expected: [0.3333]
case 4
in: [[[0,0,2,2],[1,1,3,3],[4,4,6,6]]]
expected: [0.1429,0]
case 5
in: [[[0,0,2,2]]]
expected: []
Starter codePython
def consecutive_frame_iou(boxes):
    # Your code here
    pass

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