How to output mask in mmsegmentation

The default output result in mmaegmentation is to overlap the mask with the original image. Sometimes we need to output only the mask image. The specific modification code is as follows:

Make the following settings in tools /test.py :

If there is no labeled test set, set it to None in the --eval parameter.

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')

If you want to output the final image as a Mask mask without using the original image data as the background, you can set the opacity parameter to 1

    parser.add_argument(
        '--opacity',
        type=float,
        default=1,
        help='Opacity of painted segmentation map. In (0, 1] range.')

The realization results are as follows:

 

 

Guess you like

Origin blog.csdn.net/weixin_45912366/article/details/129614594