GithubHelp home page GithubHelp logo

tony607 / keras-tf-pb Goto Github PK

View Code? Open in Web Editor NEW
60.0 4.0 41.0 26 KB

How to convert trained Keras model to a single TensorFlow .pb file and make prediction

License: Other

Jupyter Notebook 99.70% Python 0.30%
tensorflow keras

keras-tf-pb's Introduction

keras-tf-pb's People

Contributors

tony607 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

keras-tf-pb's Issues

Show graph throws error on utf-8 encoding on string

Thanks for the demo. I just copy pasted your show graph file into Jupyter using Python 2.7.
It worked just fine. A minor error when using utf-8 encoding on string. Removing encoding='utf-8' in strip_consts function solves it.

image

ValueError: Cannot create group in read only mode.


ValueError Traceback (most recent call last)
in
1 from keras.models import load_model
----> 2 model = load_model('/home/deepedge/mask_rcnn-master/mask_rcnn_damage_0010.h5')

/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in load_model(filepath, custom_objects, compile)
417 f = h5dict(filepath, 'r')
418 try:
--> 419 model = _deserialize_model(f, custom_objects, compile)
420 finally:
421 if opened_new_file:

/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py in _deserialize_model(f, custom_objects, compile)
219 return obj
220
--> 221 model_config = f['model_config']
222 if model_config is None:
223 raise ValueError('No model found in config.')

/usr/local/lib/python3.6/dist-packages/keras/utils/io_utils.py in getitem(self, attr)
300 else:
301 if self.read_only:
--> 302 raise ValueError('Cannot create group in read only mode.')
303 val = H5Dict(self.data.create_group(attr))
304 return val

ValueError: Cannot create group in read only mode.

Convert to keras-tf-pb with custom loss function

Hi,
I tried you model with a keras model of custom loss function but failed to convert as I'm getting the below error:
FailedPreconditionError: Attempting to use uninitialized value Variable
[[{{node _retval_Variable_0_5}} = _Retval[T=DT_FLOAT, index=5, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Variable)]]

Thanks for your implementation.

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.