Skip to content
DeepForgeby svx
All problems
EasyComputer Visioncv-346

CutMix Area Lambda

Problem

Compute the lambda implied by a CutMix box.

The pasted box covers (x2 - x1) * (y2 - y1) of an image_h x image_w image, so lam = 1 - area / (image_h * image_w), with negative side lengths counting as zero. Return the value rounded to 4 decimal places.

Test cases

case 1
in: [[0,0,2,2],4,4]
expected: 0.75
case 2
in: [[0,0,4,4],4,4]
expected: 0
case 3
in: [[1,1,2,2],4,4]
expected: 0.9375
case 4
in: [[3,3,2,2],4,4]
expected: 1
Starter codePython
def cutmix_area_lambda(box, image_h, image_w):
    # Your code here
    pass

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