Commit 7b425da0 authored by Oleg Dzhimiev's avatar Oleg Dzhimiev

1. back to trainable=false for rv_stage1_out

2. using main_op=tf.initialize_local_variables() when saving with builder.add_meta_graph_and_variables
parent 1709be99
...@@ -275,11 +275,15 @@ with tf.Session() as sess: ...@@ -275,11 +275,15 @@ with tf.Session() as sess:
Actually it could have been declared right here - this Actually it could have been declared right here - this
needs testing. needs testing.
NOTE: The line below makes the next script's, that saves NOTE1: The line below makes the next script's, that saves
a Saved_Model MetaGraph, size of the Saved_Model significantly a Saved_Model MetaGraph, size of the Saved_Model significantly
bigger. bigger.
NOTE2: The line below is commented in favor of (in the next script!):
builder.add_meta_graph_and_variables(sess,[tf.saved_model.tag_constants.SERVING],main_op=tf.local_variables_initializer())
''' '''
tf.add_to_collection(GraphKeys.GLOBAL_VARIABLES, rv_stage1_out) #tf.add_to_collection(GraphKeys.GLOBAL_VARIABLES, rv_stage1_out)
saver.save(sess, files["inference"]) saver.save(sess, files["inference"])
...@@ -334,7 +338,7 @@ with tf.Session() as sess: ...@@ -334,7 +338,7 @@ with tf.Session() as sess:
np.save(result_file, rslt.reshape(HEIGHT,WIDTH,-1)) np.save(result_file, rslt.reshape(HEIGHT,WIDTH,-1))
rslt = qsf.eval_results(result_file, ABSOLUTE_DISPARITY, radius=CLUSTER_RADIUS, logfile=lf) # (re-loads results). Only uses first 4 layers rslt = qsf.eval_results(result_file, ABSOLUTE_DISPARITY, radius=CLUSTER_RADIUS, logfile=lf) # (re-loads results). Only uses first 4 layers
if SAVE_TIFFS: if SAVE_TIFFS:
qsf.result_npy_to_tiff(result_file, ABSOLUTE_DISPARITY, fix_nan = True,labels=SLICE_LABELS, logfile=lf) qsf.result_npy_to_tiff(result_file, ABSOLUTE_DISPARITY, fix_nan = True, labels=SLICE_LABELS, logfile=lf)
""" """
Remove dataset_img (if it is not [0] to reduce memory footprint Remove dataset_img (if it is not [0] to reduce memory footprint
......
...@@ -227,7 +227,8 @@ with tf.Session() as sess: ...@@ -227,7 +227,8 @@ with tf.Session() as sess:
shutil.rmtree(dirs['exportdir'], ignore_errors=True) shutil.rmtree(dirs['exportdir'], ignore_errors=True)
# save MetaGraph to Saved_Model as *.pb # save MetaGraph to Saved_Model as *.pb
builder = tf.saved_model.builder.SavedModelBuilder(dirs['exportdir']) builder = tf.saved_model.builder.SavedModelBuilder(dirs['exportdir'])
builder.add_meta_graph_and_variables(sess,[tf.saved_model.tag_constants.SERVING]) builder.add_meta_graph_and_variables(sess,[tf.saved_model.tag_constants.SERVING],main_op=tf.local_variables_initializer())
#builder.add_meta_graph_and_variables(sess,[tf.saved_model.tag_constants.SERVING])
#builder.save(True) #builder.save(True)
builder.save(False) # True = *.pbtxt, False = *.pb builder.save(False) # True = *.pbtxt, False = *.pb
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment