Skip to content
DeepForgeby svx
All problems
HardComputer Visioncv-316

CIoU Aspect Term

Problem

Compute the aspect-ratio term of complete IoU (CIoU) and its trade-off weight.

With w and h the box sides, v = (4 / pi^2) * (atan(w_b / h_b) - atan(w_a / h_a))^2 and alpha = v / ((1 - IoU) + v). Return [v, alpha] rounded to 4 decimal places; use alpha = 0.0 when the denominator is zero.

Test cases

case 1
in: [[0,0,2,2],[0,0,2,2]]
expected: [0,0]
case 2
in: [[0,0,2,2],[0,0,4,1]]
expected: [0.1184,0.1508]
case 3
in: [[0,0,2,2],[1,1,3,3]]
expected: [0,0]
case 4
in: [[0,0,4,2],[0,0,2,4]]
expected: [0.1678,0.2011]
Starter codePython
def ciou_aspect_term(box_a, box_b):
    # Your code here
    pass

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