import torch


def create_area_target(mask, area):
    """Create target label for area norm loss."""
    size = mask.numel()
    target = torch.ones(size)
    if area >= 1:
        target[:int(size-area)] = 0
    else:
        target[:int(size * (1-area))] = 0
    return target