diff --git a/codes/scripts/extract_subimages_with_ref.py b/codes/scripts/extract_subimages_with_ref.py index 706a5164..7fbaf998 100644 --- a/codes/scripts/extract_subimages_with_ref.py +++ b/codes/scripts/extract_subimages_with_ref.py @@ -19,10 +19,10 @@ 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\\ns_images\\imagesets\\images' - opt['save_folder'] = 'F:\\4k6k\\datasets\\ns_images\\imagesets\\256_with_ref_v3' + opt['input_folder'] = 'F:\\4k6k\\datasets\\images\youtube\\4k_quote_unquote\\images_1' + opt['save_folder'] = 'F:\\4k6k\\datasets\\images\\youtube_massive' opt['crop_sz'] = [512, 1024, 2048] # the size of each sub-image - opt['step'] = [256, 512, 1024] # step of the sliding crop window + opt['step'] = [512, 1024, 2048] # 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['resize_final_img'] = [.5, .25, .125] diff --git a/codes/utils/util.py b/codes/utils/util.py index 0f01326f..146a880c 100644 --- a/codes/utils/util.py +++ b/codes/utils/util.py @@ -45,7 +45,10 @@ def OrderedYaml(): # Conditionally uses torch's checkpoint functionality if it is enabled in the opt file. def checkpoint(fn, *args): - enabled = loaded_options['checkpointing_enabled'] if 'checkpointing_enabled' in loaded_options.keys() else True + if loaded_options is None: + enabled = False + else: + enabled = loaded_options['checkpointing_enabled'] if 'checkpointing_enabled' in loaded_options.keys() else True if enabled: return torch.utils.checkpoint.checkpoint(fn, *args) else: