Guest User

Untitled

a guest
Dec 10th, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. from model3a import *
  2. from data import *
  3. from matplotlib import pyplot as plt
  4. import numpy
  5. from keras.utils import plot_model
  6. from PIL import Image
  7. from io import BytesIO
  8.  
  9. def labelVisualize(num_class,color_dict,img):
  10. img = img[:,:,0] if len(img.shape) == 3 else img
  11. img_out = np.zeros(img.shape + (3,))
  12. for i in range(num_class):
  13. img_out[img == i,:] = color_dict[i]
  14. return img_out / 255
  15.  
  16.  
  17.  
  18.  
  19. for filename in os.listdir('E:/unetTest/crossvalidation/val1/models'):
  20. if filename.endswith("hdf5"):
  21. #print(filename)
  22. file = open(filename,"r")
  23. print(filename)
  24. testGene = testGenerator("data")
  25. model= unet()
  26. #model.pretrained_weights= [0]
  27. #pretrained_weights = None
  28. #model= unet()
  29. #model.pretrained_weights = None
  30. #print(filename)
  31. model.load_weights(filename, "r")
  32. #print(model.pretrained_weights)
  33. results = model.predict_generator(testGene,19,verbose=1)
  34. saveResult("data",results)
  35. #model.pretrained_weights = None
  36. model.load_weights(0)
Add Comment
Please, Sign In to add comment