GithubHelp home page GithubHelp logo

psenet_cpp's Introduction

psenet_cpp

The model is trained by liuheng92/tensorflow_PSENet.

Here is my code to convert ckpt to pb:

def freeze(ckpt_path=None, save_path=None):

    from tensorflow.python.tools import freeze_graph  # , optimize_for_inference_lib

    with tf.get_default_graph().as_default():
        input_images = tf.placeholder(tf.float32, shape=[None, None, None, 3], name='input_images')
        global_step = tf.get_variable('global_step', [], initializer=tf.constant_initializer(0), trainable=False)
        seg_maps_pred = model.model(input_images, is_training=False)

        tf.identity(seg_maps_pred, name='seg_maps')

        variable_averages = tf.train.ExponentialMovingAverage(0.997, global_step)
        saver = tf.train.Saver(variable_averages.variables_to_restore())

        with tf.Session() as sess:
            saver.restore(sess, ckpt_path)

            print('Freeze Model Will Saved at ', save_path)
            fdir, name = os.path.split(save_path)
            tf.train.write_graph(sess.graph_def, fdir, name, as_text=True)

            freeze_graph.freeze_graph(
                input_graph=save_path,
                input_saver='',
                input_binary=False,
                input_checkpoint=ckpt_path,
                output_node_names='seg_maps',
                restore_op_name='',
                filename_tensor_name='',
                output_graph=save_path,
                clear_devices=True,
                initializer_nodes='',
            )

psenet_cpp's People

Contributors

afterimagex avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.