All problems
FMix Low-Frequency Mask
Problem
Build a deterministic low-frequency mask for FMix-style augmentation.
At pixel (i, j) compute v = 0.5 * (cos(2*pi*i/h) + cos(2*pi*j/w)); the mask value is 1 when v > threshold, otherwise 0. Return the H x W mask.
Test cases
case 1
in: [4,4,0]
expected: [[1,1,0,1],[1,1,0,0],[0,0,0,0],[1,0,0,0]]
case 2
in: [4,4,0.5]
expected: [[1,0,0,0],[0,0,0,0],[0,0,0,0],[0,0,0,0]]
case 3
in: [2,2,-0.5]
expected: [[1,1],[1,0]]
Starter codePython
def fmix_mask(h, w, threshold):
# Your code here
pass3 test cases · run your code against them in the editor