Git Product home page Git Product logo

freeze_tf_model's Introduction

freeze_tf_model

一个将 tensorflow 模型静态化的工具,方便微服务加载

Tensorflow 的 tf.train.Saver 保存的模型 checkpoint 无法直接被 serving 代码调用,这个工具从 checkpoint 导入模型,将模型中的所有参数常量化, 然后将模型保存在单一文件中方便调用。

使用方法

./freeze_model.py --model_dir <checkpoint 保存的目录> --output_node_names <需要输出的节点名>

注意:

  1. checkpoint 保存的目录最后不要有 "/"
  2. 需要输出的节点名可以有多个,用逗号分隔,如果你用 golang 实现 serving 服务,通常是 session.Run 中的 output 节点的名字,如 这段代码 中包含了三个输出节点,"lstm/initial_state", "softmax", "lstm/state"。
  3. 输出的 frozen_model.pb 保存在 --model_dir 中

freeze_tf_model's People

Contributors

huichen avatar

Watchers

James Cloos 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.