问题描述
我正在处理 Cityscapes
数据集。但是我在可视化测试集中的 rgb 掩码时遇到了问题。我正在做的事情如下:
从根读取掩码:
root_path = './Baysian_Seg/Inputs/Cityscapes/test_labels'
mask_root = os.path.join(root_path,'ex_test_labels')
berlin_mask_list= sorted(os.listdir(os.path.join(mask_root,'berlin')))
mask_lists = ['berlin_000010_000019_gtFine_color.png','berlin_000010_000019_gtFine_instanceIds.png','berlin_000010_000019_gtFine_labelIds.png','berlin_000010_000019_gtFine_polygons.json']
mask1 = Image.open(os.path.join(mask_root,'berlin',mask_lists[0]))
plt.imshow(mask1)
但我只会得到一张黑色图像。我不知道我哪里出错了。我对训练和验证集做了同样的事情,我可以正确地可视化掩码。我将不胜感激。
附言我还尝试使用:PIL
转换 maks1.convert('RGB')
掩码,但也没有帮助。
解决方法
不能测试cityscapes,测试数据集不公开,所以测试集中的图片都是黑色的。