参考mmdetection代码

地址:https://github.com/open-mmlab/mmdetection/blob/master/mmdet/core/visualization/image.py:

state = np.random.get_state()
# random color
np.random.seed(42)
mask_colors = [
    np.random.randint(0, 256, (1, 3), dtype=np.uint8)[0].tolist()
    for _ in range(len(categories))
]
np.random.set_state(state)
posted on 2021-10-25 18:30  一点飞鸿  阅读(133)  评论(0编辑  收藏  举报