All problems
MAE Patch Masking Count
Problem
Compute the number of patches and masked patches for masked autoencoders. For a square image and square patch size, num_patches = (image_size // patch_size)^2 and the masked count is round(num_patches * mask_ratio).
The signature is mae_patch_mask_count(image_size, patch_size, mask_ratio). Return [num_patches, num_masked].
Hint
MAE typically masks 75 percent of the patches and encodes only the visible ones.
Test cases
case 1
in: [224,16,0.75]
expected: [196,147]
case 2
in: [32,8,0.5]
expected: [16,8]
case 3
in: [96,16,0.25]
expected: [36,9]
case 4
in: [64,16,0.5]
expected: [16,8]
Starter codePython
def mae_patch_mask_count(image_size, patch_size, mask_ratio):
# Your code here
pass4 test cases · run your code against them in the editor