Guest User

Untitled

a guest
Jun 20th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. import os
  2. import numpy as np
  3. from keras.preprocessing import image
  4.  
  5. PATH = os.getcwd()
  6.  
  7. train_path = PATH+'/data/train/'
  8. train_batch = os.listdir(train_path)
  9. x_train = []
  10.  
  11. # load train data
  12. for sample in train_data:
  13. img_path = train_path+sample
  14. x = image.load_img(img_path)
  15. # preprocessing disini
  16. x_train.append(x)
  17.  
  18. test_path = PATH+'/data/test/'
  19. test_batch = os.listdir(test_path)
  20. x_test = []
  21.  
  22. for sample in test_data:
  23. img_path = test_path+sample
  24. x = image.load_img(img_path)
  25. # preprocessing disini
  26. x_test.append(x)
  27.  
  28.  
  29. x_train = np.array(x_train)
  30. x_test = np.array(x_test)
Add Comment
Please, Sign In to add comment