Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different output between .pb and .ckpt file #59

Open
YIYANGCAI opened this issue Jun 30, 2020 · 0 comments
Open

Different output between .pb and .ckpt file #59

YIYANGCAI opened this issue Jun 30, 2020 · 0 comments

Comments

@YIYANGCAI
Copy link

Hello!
Thanks for this great work of text detection. I am recently working on a task of text detection and applying this model. the performance on my own data after training is wonderful. However, when I converted my training model of ckpt to pb model, the inference result of pb changes a lot. I cannot find out where the problem is, could you help me to locate my problem?

here is my conversion code from ckpt to pb model:


def freezeGraph(input_checkpoint, output_nodes_names, output_graph):
    '''
    :param input_checkpoint:
    :param output_graph: 
    :return:
    '''
    # checkpoint = tf.train.get_checkpoint_state(model_folder) 
    # input_checkpoint = checkpoint.model_checkpoint_path 
 
    # 
    output_node_names = output_nodes_names
    saver = tf.train.import_meta_graph(input_checkpoint + '.meta', clear_devices=True)
    graph = tf.get_default_graph() # 
    input_graph_def = graph.as_graph_def()  # 
 
    with tf.Session() as sess:
        saver.restore(sess, input_checkpoint) #
        output_graph_def = graph_util.convert_variables_to_constants(  # 
            sess=sess,
            input_graph_def=input_graph_def,# 
            output_node_names=output_node_names)# 
 
        with tf.gfile.GFile(output_graph, "wb") as f: 
            f.write(output_graph_def.SerializeToString()) 
        print("%d ops in the final graph." % len(output_graph_def.node)) 


if __name__ == '__main__':
    nodes = getOutNodes('./seglink.txt') 
    freezeGraph('./ckpt/model.ckpt-5882', nodes, './pb/seglink.pb')

the seglink.txt is recording the nodes' name of nodes
seglink.txt

I wonder if its the problem of conversion

With many thanks if you can offer me some help of this problem!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant