Skip to content
Snippets Groups Projects
Commit e80c87ff authored by Bobholamovic's avatar Bobholamovic
Browse files

Fix filename without suffix

parent a4d70bc2
No related branches found
No related tags found
1 merge request!1Update content
This commit is part of merge request !1. Comments created here will be created in the context of that merge request.
...@@ -59,6 +59,9 @@ class _AirChangeDataset(CDDataset): ...@@ -59,6 +59,9 @@ class _AirChangeDataset(CDDataset):
label = (label / 255.0).astype(np.uint8) # To 0,1 label = (label / 255.0).astype(np.uint8) # To 0,1
return label if self.phase == 'train' else self.cropper(label) return label if self.phase == 'train' else self.cropper(label)
def get_name(self, index):
return '{loc}-{id}-cm.bmp'.format(loc=self.LOCATION, id=index)
@staticmethod @staticmethod
def _bmp_loader(bmp_path_wo_ext): def _bmp_loader(bmp_path_wo_ext):
# Case insensitive .bmp loader # Case insensitive .bmp loader
......
from os.path import join, expanduser, basename, exists from os.path import join, expanduser, basename, exists, splitext
import torch import torch
import torch.utils.data as data import torch.utils.data as data
...@@ -41,7 +41,7 @@ class CDDataset(data.Dataset): ...@@ -41,7 +41,7 @@ class CDDataset(data.Dataset):
if self.phase == 'train': if self.phase == 'train':
return t1, t2, label return t1, t2, label
else: else:
return basename(self.label_list[index]), t1, t2, label return self.get_name(index), t1, t2, label
def _read_file_paths(self): def _read_file_paths(self):
raise NotImplementedError raise NotImplementedError
...@@ -52,6 +52,9 @@ class CDDataset(data.Dataset): ...@@ -52,6 +52,9 @@ class CDDataset(data.Dataset):
def fetch_image(self, image_path): def fetch_image(self, image_path):
return default_loader(image_path) return default_loader(image_path)
def get_name(self, index):
return splitext(basename(self.label_list[index]))[0]+'.bmp'
def preprocess(self, t1, t2, label): def preprocess(self, t1, t2, label):
if self.transforms[0] is not None: if self.transforms[0] is not None:
# Applied on all # Applied on all
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment