LeeJunHyun / Image_Segmentation

Pytorch implementation of U-Net, R2U-Net, Attention U-Net, and Attention R2U-Net.
2.66k stars 594 forks source link

how to custom the dataset folder? #67

Closed zhou-rui1 closed 1 year ago

zhou-rui1 commented 3 years ago

Hi, I always get naming error when loading my own dataset: FileNotFoundError: [Errno 2] No such file or directory: './dataset/train_GT./dataset/train/32.png' My folder structure: ––dataset ——train ———0.jpg ———1.jpg ——train_GT ———0.png ———1.png is there something wrong with the filename? and I change GT_path as follows: ` def getitem(self, index):

    image_path = self.image_paths[index]
    filename = image_path.split('_')[-1][:-len(".jpg")]
    GT_path = self.GT_paths + filename + '.png'`

Any help would be so grateful!

cosmosnn1 commented 3 years ago
          you can  change codes like this: image_path = self.image_paths[index]
    filename = image_path.split('/')[-1][:-len(".jpg")]
    GT_path = self.GT_paths  + filename + '.png'