def mask_percentage(mask):
    """Returns the percentage of pixels in the mask that are True.

    :param mask: HxW bool NumPy array (False for locations to be excluded)
    :return: float
    """
    return mask.sum() / mask.size