def __init__(self, name='synthetic'): if name == 'synthetic': data_path = test_synthetic_path elif name == 'chickpea': data_path = test_chickpea_path else: raise ValueError('wrong name') if os.path.exists(data_path): self.input_ids = get_files(data_path + 'binary_input/') self.target_ids = get_files(data_path + 'binary_target/') else: raise ValueError("data path do not exist:{}".format(data_path))
def __init__(self, which_set): assert which_set in ['train', 'valid', 'test'], "wrong set:{}".format(which_set) if which_set is 'train': self.training = True else: self.training = False self.base_path = os.path.join(dirname, 'data/road') path = os.path.join(self.base_path, which_set + '/') self.image_ids = get_files(path, format='png')
def __init__(self, model, config): super(UnetEvaluator, self).__init__(model, config) self.syn_test_dataloader = module_data.TestRootDataLoader( name='synthetic') self.real_test_dataloader = module_data.TestRootDataLoader( name='chickpea') self.chickpea_test_file_list = get_files(chickpea_valid_path) self.testing_dir = os.path.join(self.config["checkpoint_dir"], 'testing') ensure_dir(self.testing_dir)
def __init__(self, which_set='train'): """ :param which_set: 'train', 'valid', or 'test' """ assert which_set in ['train', 'valid', 'test'], "wrong set:{}".format(which_set) if which_set in ['train']: self.training = True else: self.training = False self.which_set = which_set chickpea_patch_path = os.path.join(dirname, 'data/root/real/patch/') # get file list as image ids path_to_files = os.path.join(chickpea_patch_path, which_set + '/') if os.path.exists(path_to_files): self.ids = get_files(path_to_files) else: raise ValueError("data path do not exist:{}".format(path_to_files))
def __init__(self, which_set='train'): assert which_set in ['train', 'valid', 'test'], "wrong set:{}".format(which_set) if which_set is 'train': self.training = True else: self.training = False if which_set is 'test': file_format = 'tif' else: file_format = 'png' self.which_set = which_set # get file list as image ids retinal_full_path = os.path.join(dirname, 'data/retinal/') path_to_files = os.path.join(retinal_full_path, which_set + '/') if os.path.exists(path_to_files): self.ids = get_files(path_to_files, format=file_format) else: raise ValueError("data path do not exist:{}".format(path_to_files))
def __init__(self, which_set='train', dilation=True, noisy_texture=True, rotation=True): """ Synthetic root dataset initialization :param which_set: str: 'train', 'valid', 'test' :param dilation: flag of root dilation :param noisy_texture: flag of noisy texture :param rotation: flag of rotation augmentation """ assert which_set in ['train', 'valid', 'test', 'test/total' 'p', 't'], "wrong set:{}".format(which_set) if which_set in ['train', 't']: self.training = True else: self.training = False if which_set == 'test': which_set += '/total' self.which_set = which_set self.dilation = dilation self.noisy_texture = noisy_texture self.rotation = rotation # synthetic root data path synthetic_path = os.path.join(dirname, 'data/root/synthetic') # get file list as image ids path_to_files = os.path.join(synthetic_path, which_set + '/') if os.path.exists(path_to_files): ids = get_files(path_to_files) # remove root images that are too thin self.ids = self.select_images(ids) else: raise ValueError("data path do not exist:{}".format(path_to_files))