def mask_size(points, img_size):
    """
    Return a mask filtering out the points that are outside of img_size.
    """
    mask = ((points[:, 0] >= 0)
            & (points[:, 0] < img_size[0])
            & (points[:, 1] >= 0)
            & (points[:, 1] < img_size[1]))
    return mask.astype(float)