Giter Club home page Giter Club logo

tf-graph-freeze's Introduction

Tensorflow Graph Freezer

Tensorflow Graph Freezer for serving it on GCP

This is a simple helper for:

  • Visualizing a saved checkpoint in Tensorboar
  • Selecting the nodes that will be on the freezed model
  • Freezing a Tensorflow Graph to serve on GCP

Module 1: "model_to_tensorboard.py":

This module exports the graph to be visualized on Tensorboard

optional arguments:
-h, --help            Show this help message and exit
-d, --dir             Tensorflow models's directory
-s, --savedir         Logdir of tensorboard

Module 2: "nodes_extract.py":

Generate a pickled nodes list from the provided node

optional arguments:
-h, --help            show this help message and exit
-l [LIST [LIST ...]], --list [LIST [LIST ...]]
                        List of words in nodes names to be excluded. If
                        omited, all nodes will be kept
-d DIR, --dir DIR       Directory to save the nodes list
-s SAVE_DIR, --save_dir SAVE_DIR
                        Save dir for the generated list. If 'None' is
                        provided, no list will be saved

Module 3: "freeze_graph.py":

A simple Graph freezer for Tensorflow on GCP

optional arguments:
-h, --help              show this help message and exit
-d DIR, --dir DIR       Tensorflow domel's directory
-s SAVE_DIR, --save_dir SAVE_DIR
                        Directory where the frozen graph will be saved
-i [INPUTS [INPUTS ...]], --inputs [INPUTS [INPUTS ...]]
                        Input tensor list
-o [OUTPUTS [OUTPUTS ...]], --outputs [OUTPUTS [OUTPUTS ...]]
                        Output tensor list
-n NODES, --nodes NODES
                        Pickled file wich contains the nodes to be kept

Usage

Step 1: Visualize the tensorboard to see wich nodes will be kept and wich are the input and output nodes

Extract the model to tensorboard:

$ python model_to_tensorboard.py -d {model_dir} -s {save_dir}

Run Tensorboard

$ tensorboard --logdir {save_dir}

Step 2: Create the list containing the nodes to be kept in the final graph

Create the list passing the node names or node names keywords to remove them from the graph

$ python nodes_extract.py -l {list} -d {model_dir} -s {save_dir}

Step 3: Freeze the graph to be served on GCP

$ python freeze_graph.py -d {model_dir} -i  {input_node} -o {outout_node} -n  {node_list} -s {save_dir}

tf-graph-freeze's People

Contributors

guiuzeda 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.