转自:https://blog.csdn.net/weixin_42388228/article/details/88235240
改变label颜色:
colormap = label_colormap(255) lbl_pil.putpalette((colormap * 255).astype(np.uint8).flatten())