Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions prediction.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,15 @@ def get_prediction(smg, sml, indexes, bls, blhs, dis, dps, dphs, model_name):
w = [0.86, 0.8, 0.06]
for i in range(1, 4):
try:
model = tf.train.import_meta_graph(
model = tf.compat.v1.train.import_meta_graph(
model_name + '_v' + str(i) + '/model.ckpt.meta')
except BaseException:
print("Something wrong with the model.")
continue
with tf.Session() as sess:
with tf.compat.v1.Session() as sess:
try:
model.restore(sess, model_name + '_v' + str(i) + "/model.ckpt")
graph = tf.get_default_graph()
graph = tf.compat.v1.get_default_graph()
synmgt, synmlt, blst, \
blhst, dpst, dphst, \
dist, lrt, yt = graph.get_collection("input_nodes")
Expand Down Expand Up @@ -114,7 +114,7 @@ def get_prediction(smg, sml, indexes, bls, blhs, dis, dps, dphs, model_name):
preds_t_2 = sess.run([predictions], feed_dict=fd)
preds_t_2 = np.array(preds_t_2)[0]
preds = preds + w[i - 1] * (preds_t_1 + preds_t_2) / 2
tf.reset_default_graph()
tf.compat.v1.reset_default_graph()
preds = np.argmax(preds, axis=1)
print(preds.shape)
return preds
Expand Down