-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathload.py
More file actions
25 lines (21 loc) · 823 Bytes
/
Copy pathload.py
File metadata and controls
25 lines (21 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import initial
import numpy as np
import keras.models
from keras.models import model_from_json
from scipy.misc import imread, imresize,imshow
import tensorflow as tf
def init():
json_file = open('model_arch.json','r')
loaded_model_json = json_file.read()
json_file.close()
loaded_model = model_from_json(loaded_model_json,custom_objects={'ZeroPadding': initial.ZeroPadding,'CorrnetCost': initial.CorrnetCost})
#load woeights into new model
loaded_model.load_weights("model_wts.h5")
print("Loaded Model from disk")
#compile and evaluate loaded model
#loaded_model.comp?ile(loss='categorical_crossentropy',optimizer='adam',metrics=['accuracy'])
#loss,accuracy = metricsodel.evaluate(X_test,y_test)
#print('loss:', loss)
#print('accuracy:', accuracy)
graph = tf.get_default_graph()
return loaded_model,graph