在mmaegmentation中默认的输出结果是将mask与原图重叠在一起,有时候我们需要输出只有mask的图,具体修改代码如下:
在tools/test.py中进行如下设置:
如果没有标签的测试集中,在–eval参数中设置为None即可。
parser.add_argument(
'--eval',
type=str,
nargs='+',
default=None, # change this parament
help='evaluation metrics, which depends on the dataset, e.g., "mIoU"'
' for generic datasets, and "cityscapes" for Cityscapes')
如果想要输出最终的图像为Mask掩膜,不将原图数据作为背景,可以设置opacity参数为1
parser.add_argument(
'--opacity',
type=float,
default=1,
help='Opacity of painted segmentation map. In (0, 1] range.')
实现结果如下: