forked from mrq/DL-Art-School
Fix bug with single_image_dataset which prevented working on multiple directories from working
This commit is contained in:
parent
ae666dc520
commit
7938f9f50b
|
@ -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.
|
# Indexing this dataset is tricky. Aid it by having a list of starting indices for each chunk.
|
||||||
start = 0
|
start = 0
|
||||||
self.starting_indices = []
|
self.starting_indices = []
|
||||||
for c in chunks:
|
for c in self.chunks:
|
||||||
self.starting_indices.append(start)
|
self.starting_indices.append(start)
|
||||||
start += len(c)
|
start += len(c)
|
||||||
self.len = start
|
self.len = start
|
||||||
|
|
|
@ -28,6 +28,10 @@ class ChunkWithReference:
|
||||||
if tile_id in centers.keys():
|
if tile_id in centers.keys():
|
||||||
center, tile_width = centers[tile_id]
|
center, tile_width = centers[tile_id]
|
||||||
elif self.strict:
|
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])
|
raise FileNotFoundError(tile_id, self.tiles[item])
|
||||||
else:
|
else:
|
||||||
center = torch.tensor([128, 128], dtype=torch.long)
|
center = torch.tensor([128, 128], dtype=torch.long)
|
||||||
|
|
|
@ -50,6 +50,7 @@ if __name__ == '__main__':
|
||||||
'force_multiple': 32,
|
'force_multiple': 32,
|
||||||
'scale': 2,
|
'scale': 2,
|
||||||
'eval': False,
|
'eval': False,
|
||||||
|
'strict': False,
|
||||||
'fixed_corruptions': ['jpeg-broad', 'gaussian_blur'],
|
'fixed_corruptions': ['jpeg-broad', 'gaussian_blur'],
|
||||||
'random_corruptions': ['noise-5', 'none'],
|
'random_corruptions': ['noise-5', 'none'],
|
||||||
'num_corrupts_per_image': 1,
|
'num_corrupts_per_image': 1,
|
||||||
|
|
|
@ -19,12 +19,12 @@ def main():
|
||||||
# compression time. If read raw images during training, use 0 for faster IO speed.
|
# compression time. If read raw images during training, use 0 for faster IO speed.
|
||||||
|
|
||||||
opt['dest'] = 'file'
|
opt['dest'] = 'file'
|
||||||
opt['input_folder'] = 'F:\\4k6k\\datasets\\images\youtube\\4k_quote_unquote\\images_1'
|
opt['input_folder'] = 'F:\\4k6k\\datasets\\images\youtube\\images_cook'
|
||||||
opt['save_folder'] = 'F:\\4k6k\\datasets\\images\\youtube_massive'
|
opt['save_folder'] = 'F:\\4k6k\\datasets\\images\\youtube_massive_cook'
|
||||||
opt['crop_sz'] = [512, 1024, 2048] # the size of each sub-image
|
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['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['resize_final_img'] = [.5, .25, .125]
|
||||||
opt['only_resize'] = False
|
opt['only_resize'] = False
|
||||||
opt['vertical_split'] = False
|
opt['vertical_split'] = False
|
||||||
|
|
Loading…
Reference in New Issue
Block a user