Advertisement
Merevoli

Untitled

Apr 21st, 2022
52
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import pickle
  2. import copy
  3. from PIL import Image
  4.  
  5. data = {}
  6.  
  7. dir_name = "./data/data04_train"
  8. for i in range(1, 100001):
  9. file_name = f"{dir_name}/{i}.jpg"
  10. im = Image.open(file_name)
  11. data[f'{i}.jpg'] = copy.deepcopy(im)
  12. im.close()
  13.  
  14. pickle.dump(data, open('data.pkl', 'wb'))
Advertisement
RAW Paste Data Copied
Advertisement