CVPR/lama-example
4
1import os2import random3 4test_files_path = os.path.abspath('.') + '/places_standard_dataset/original/test/'5test_files = [test_files_path + image for image in os.listdir(test_files_path)]6print(f'found {len(test_files)} images in {test_files_path}')7 8random.shuffle(test_files)9test_files_random = test_files[0:2000]10#print(test_files_random[0:10])11 12list_of_random_test_files = os.path.abspath('.') \13+ '/places_standard_dataset/original/test_random_files.txt'14 15print(f'copying 100 random images to {list_of_random_test_files}')16with open(list_of_random_test_files, 'w') as fw:17 for filename in test_files_random:18 fw.write(filename+'\n')19print('...done')20 21# ----------------------------------------------------------------------------------22 23 24val_files_path = os.path.abspath('.') + '/places_standard_dataset/original/val/'25val_files = [val_files_path + image for image in os.listdir(val_files_path)]26print(f'found {len(val_files)} images in {val_files_path}')27 28random.shuffle(val_files)29val_files_random = val_files[0:100]30 31list_of_random_val_files = os.path.abspath('.') \32+ '/places_standard_dataset/original/val_random_files.txt'33 34print(f'copying 100 random images to {list_of_random_val_files}')35with open(list_of_random_val_files, 'w') as fw:36 for filename in val_files_random:37 fw.write(filename+'\n')38print('...done') 39 40 