def create_dataset_structure(dest, subsets): if os.path.exists(dataset_dest): raise Exception("Destination folder already exists") os.makedirs(dataset_dest) for set in subsets: sub_dir = dataset_dest + "/" + set os.makedirs(sub_dir) os.makedirs(sub_dir + "/labels") os.makedirs(sub_dir + "/data") dataset_base = "/home/olav/Pictures/Norwegian_roads_dataset" dataset_dest = "/home/olav/Pictures/Norwegian_roads_dataset_alpha" datasets = loader.get_dataset(dataset_base) color_to_alpha = False content = ["data"] create_dataset_structure(dataset_dest, datasets) for set in datasets: for t in content: rel_path = "/" + set + "/" + t images = loader.get_image_files(dataset_base + rel_path) for img_path in images: src_path = dataset_base + rel_path + "/" + img_path dest_path = dataset_dest + rel_path + "/" + img_path
def load_dataset(self): test_path, train_path, valid_path = util.get_dataset(self.dataset_path) self.test = Dataset("Test set", self.dataset_path, test_path, self.reduce_testing ) self.train = Dataset("Training set", self.dataset_path, train_path, self.reduce_training ) self.valid = Dataset("Validation set", self.dataset_path, valid_path, self.reduce_validation)