def _random_data(self):
    (H, W) = (100, 100)
    N = 10
    img = (np.random.rand(H, W, 3) * 255)
    boxxy = (np.random.rand(N, 2) * (H // 2))
    boxes = np.concatenate((boxxy, (boxxy + (H // 2))), axis=1)

    def _rand_poly():
        return (np.random.rand(3, 2).flatten() * H)
    polygons = [[_rand_poly() for _ in range(np.random.randint(1, 5))] for _ in range(N)]
    mask = np.zeros_like(img[:, :, 0], dtype=np.bool)
    mask[:10, 10:20] = 1
    labels = [str(i) for i in range(N)]
    return (img, boxes, labels, polygons, ([mask] * N))
def _random_data(self):
    (H, W) = (100, 100)
    N = 10
    img = (np.random.rand(H, W, 3) * 255)
    boxxy = (np.random.rand(N, 2) * (H // 2))
    boxes = np.concatenate((boxxy, (boxxy + (H // 2))), axis=1)

    def _rand_poly():
        return (np.random.rand(3, 2).flatten() * H)
    polygons = [[_rand_poly() for _ in range(np.random.randint(1, 5))] for _ in range(N)]
    mask = np.zeros_like(img[:, :, 0], dtype=np.bool)
    mask[:10, 10:20] = 1
    labels = [str(i) for i in range(N)]
    return (img, boxes, labels, polygons, ([mask] * N))