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