def random_colors(N, bright=True):

    """
    Generate random colors.
    To get visually distinct colors, generate them in HSV space then
    convert to RGB.
    """
    brightness = 1.0 if bright else 0.7
    hsv = np.random.rand(N, 3)
    hsv[:, 1] = 1
    hsv[:, 2] = brightness
    # hsv = [(i / N, 1, brightness) for i in range(N)]
    colors = list(map(lambda c: colorsys.hsv_to_rgb(*c), hsv))
    random.shuffle(colors)
    return colors

    Generate random colors.
    To get visually distinct colors, generate them in HSV space then
    convert to RGB.
    
lib/model/utils/net_utils.py