layout_generate_dataset.py 文件源码

python
阅读 30 收藏 0 点赞 0 评论 0

项目:DocumentSegmentation 作者: SeguinBe 项目源码 文件源码
def make_cmap(N_CLASSES):
    # Generate the colors for the classes (with background class being 0,0,0)
    c_size = 2**N_CLASSES - 1
    cmap = np.concatenate([[[0, 0, 0]], plt.cm.Set1(np.arange(c_size) / (c_size))[:, :3]])
    cmap = (cmap * 255).astype(np.uint8)
    assert N_CLASSES <= 8, "ARGH!! can not handle more than 8 classes"
    c_full_label = np.unpackbits(np.arange(2 ** N_CLASSES).astype(np.uint8)[:, None], axis=-1)[:, -N_CLASSES:]
    return cmap, c_full_label
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号