pytorch-unet训练报错Either nomask or multiple masks found for the ID

项目地址:https://github.com/milesial/Pytorch-UNet

报错内容:

Either no mask or multiple masks found for the ID{idx}:{mask_file}'

AssertionError:Either no mask or multiple masks found for the ID.

 

解决方案:

data_loading中的CarvanaDataset类下的改为mask_suffix='', 附上修改后的代码:

class CarvanaDataset(BasicDataset):
    def __init__(self, images_dir, masks_dir, scale=1):
        super().__init__(images_dir, masks_dir, scale, mask_suffix=''
# mask_suffix='_mask'被修改为mask_suffix=''
posted @ 2021-10-11 11:45  重大的小鸿  阅读(1642)  评论(0编辑  收藏  举报