Guest User

Untitled

a guest
Oct 19th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. import shutil
  2. import os.path
  3. for i in range(len(pairs)):
  4. if i in train_set:
  5. s = 'train'
  6. elif i in test_set:
  7. s = 'test'
  8. elif i in val_set:
  9. s = 'val'
  10.  
  11. 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'):
  12. shutil.copy('path/to/images/prefix_' + str(pairs[i][0]).zfill(4) + '.png', 'A/' + s + '/' + str(pairs[i][0]) + '_' + str(pairs[i][1]) + '.png')
  13. 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