convert ckpt to .pb
I used the following code to generate the .pb file,
import tensorflow as tf
import os
from tensorflow.python.tools import freeze_graph
import model
model_path = ""
def main():
tf.reset_default_graph()
input_node = tf.placeholder(tf.float32, shape=(320, 320, 3))
input_node = tf.expand_dims(input_node, 0)
flow,b = model.model(input_node)
saver = tf.train.Saver()
with tf.Session() as sess:
saver.restore(sess, model_path)
tf.train.write_graph(sess.graph_def, 'output_model/pb_model', 'model.pb')
freeze_graph.freeze_graph('output_model/pb_model/model.pb', '', False, model_path, "feature_fusion/Conv_7/Sigmoid,feature_fusion/concat_3",'save/restore_all', 'save/Const:0', 'output_model/pb_model/frozen_model.pb', False, "")
but the following error occurred during the run. I don't know much about tensorflow. which step leads to this error.
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.0.0-alpha) /home/swd/soft/opencv/opencv/modules/dnn/src/tensorflow/tf_importer.cpp:1380: error: (-215:Assertion failed) scaleMat.type() == CV_32FC1 in function 'populateNet'
I have the same error, did you find the solution ?