Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import shutil
- import os.path
- for i in range(len(pairs)):
- if i in train_set:
- s = 'train'
- elif i in test_set:
- s = 'test'
- elif i in val_set:
- s = 'val'
- if os.path.exists('path/to/images/prefix_' + str(pairs[i][0]).zfill(4) + '.png') and os.path.exists('path/to/images/prefix_' + str(pairs[i][1]).zfill(4) + '.png'):
- shutil.copy('path/to/images/prefix_' + str(pairs[i][0]).zfill(4) + '.png', 'A/' + s + '/' + str(pairs[i][0]) + '_' + str(pairs[i][1]) + '.png')
- shutil.copy('path/to/images/prefix_' + str(pairs[i][1]).zfill(4) + '.png', 'B/' + s + '/' + str(pairs[i][0]) + '_' + str(pairs[i][1]) + '.png')
Add Comment
Please, Sign In to add comment