Fix bug with single_image_dataset which prevented working on multiple directories from working

This commit is contained in:
James Betker 2020-12-19 15:13:46 -07:00
parent ae666dc520
commit 7938f9f50b
4 changed files with 10 additions and 5 deletions

View File

@ -50,7 +50,7 @@ class BaseUnsupervisedImageDataset(data.Dataset):
# Indexing this dataset is tricky. Aid it by having a list of starting indices for each chunk.
start = 0
self.starting_indices = []
for c in chunks:
for c in self.chunks:
self.starting_indices.append(start)
start += len(c)
self.len = start

View File

@ -28,6 +28,10 @@ class ChunkWithReference:
if tile_id in centers.keys():
center, tile_width = centers[tile_id]
elif self.strict:
print("Could not find the given tile id in the accompanying centers.pt. This generally means that "
"centers.pt was overwritten at some point e.g. by duplicate data. If you don't care about tile "
"centers, consider passing strict=false to the dataset options. (Note: you must re-build your"
"caches for this setting change to take effect.)")
raise FileNotFoundError(tile_id, self.tiles[item])
else:
center = torch.tensor([128, 128], dtype=torch.long)

View File

@ -50,6 +50,7 @@ if __name__ == '__main__':
'force_multiple': 32,
'scale': 2,
'eval': False,
'strict': False,
'fixed_corruptions': ['jpeg-broad', 'gaussian_blur'],
'random_corruptions': ['noise-5', 'none'],
'num_corrupts_per_image': 1,

View File

@ -19,12 +19,12 @@ def main():
# compression time. If read raw images during training, use 0 for faster IO speed.
opt['dest'] = 'file'
opt['input_folder'] = 'F:\\4k6k\\datasets\\images\youtube\\4k_quote_unquote\\images_1'
opt['save_folder'] = 'F:\\4k6k\\datasets\\images\\youtube_massive'
opt['input_folder'] = 'F:\\4k6k\\datasets\\images\youtube\\images_cook'
opt['save_folder'] = 'F:\\4k6k\\datasets\\images\\youtube_massive_cook'
opt['crop_sz'] = [512, 1024, 2048] # the size of each sub-image
opt['step'] = [512, 1024, 2048] # step of the sliding crop window
opt['step'] = [256, 512, 1024] # step of the sliding crop window
opt['exclusions'] = [[],[],[]] # image names matching these terms wont be included in the processing.
opt['thres_sz'] = 256 # size threshold
opt['thres_sz'] = 128 # size threshold
opt['resize_final_img'] = [.5, .25, .125]
opt['only_resize'] = False
opt['vertical_split'] = False