Code Monkey home page Code Monkey logo

keras-to-tensorflow's People

Contributors

bitbionic 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  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  avatar  avatar  avatar  avatar  avatar

keras-to-tensorflow's Issues

error: this TensorFlow binary was not compiled to use: AVX2 FMA

When I use the k2tf_convert.py script:
python k2tf_convert.py -m 'version0320.h5' -n 1

I got error:
2018-07-20 09:54:38.200577: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA

I tried on two machines(VM on DO & Mac), same error. What should I do now?

Thank you very much!

Can't convert pb model to tflite model

Hi, I used your script k2tf_convert.py to convert my trained Keras model to .pb format. Next I wanted to use it to convert to tflite model. When I call tf.lite.TFLiteConverter.from_saved_model(saved_model_dir) on the pb model, it throws an error
RuntimeError: MetaGraphDef associated with tags {'serve'} could not be found in SavedModel. To inspect available tag-sets in the SavedModel, please use the SavedModel CLI: saved_model_cli``

Can you give any pointers as to what I should do to make this work. Initially I wanted to convert my Keras models to lite models for post-training quantization. I run saved_model_cli show --dir <dir> but it shows empty result, no tags.

Custom objects

I have a custom loss function that I specify upon model load:

models.load_model(some_model_file, custom_objects=some_custom_loss_function)

Can the H5 to PB converter handle this?

build_tutorial_cpp.sh doesn't work

I have tried to build build_tutorial_cpp.sh but failed.
There is no protobuf folder in my ~/../tensorflow/bazel-tensorflow/external. There is a protobuf_archive folder. I have also tried with this but failed. Also there is no ltensorflow_cc file in my ~/../tensorflow/bazel-bin/tensorflow path.

I have attached the error image.

keras_2_tf_cpp

Please help me to solve this. Thanks.

problem with making batch inference with converted graph

There is a problem in the k2tf_convert.py file with aliasing the output nodes. The following line
pred[i] = tf.identity(net_model.output[i], name=pred_node_names[i])
should be
pred[i] = tf.identity(net_model.outputs[i], name=pred_node_names[i])

I have wasted days wondering why I am not able to make batch inference with the converted graph and this turned out to be the reason. The output shape did not have a [None] index that allows it to do multiple outtputs.

GPU?

Hi - Thanks for this implementation. Does this have support for GPU?

Flower Dataset Question

Hello bitbionic,
Thanks for your great work on keras2tensorflow.
I'm trying to follow your guide step by step.
Here is a question I want consult for your help.

After extracting the data you should see a folder structure similar to the image shown here. There are 5 categories and the data is pre-sorted into test and train.

But after extracting as mentioned, it seems that the data hasn't been pre-sorted.
And there is no label.txt.

Where can I download the relevant pre-sorted data?
Thank you very much!

ValueError: Cannot create group in read only mode.

while running

sudo python3 k2tf_convert.py -m '/home/deepedge/mask_rcnn-master/mask_rcnn_damage_0010.h5' -n 1

Using TensorFlow backend.
Traceback (most recent call last):
File "k2tf_convert.py", line 95, in
convertGraph( args.model, args.outdir, args.num_out, args.prefix, args.name )
File "k2tf_convert.py", line 61, in convertGraph
net_model = load_model(modelPath)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 419, in load_model
model = _deserialize_model(f, custom_objects, compile)
File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 221, in _deserialize_model
model_config = f['model_config']
File "/usr/local/lib/python3.6/dist-packages/keras/utils/io_utils.py", line 302, in getitem
raise ValueError('Cannot create group in read only mode.')
ValueError: Cannot create group in read only mode.

@bitbionic @bitbionic

For which tensorflow version and system configuration does it work?

Hello, I am trying to follow your tutorial for creating a bazel independent C++ application which uses tensorflow. On executing build_tutorial_cpp.sh, I am getting an error about missing header file google/protobuf/arena.h. I observed that this and other header files are getting created somewhere in my local .cache directory instead of the root of the project. I wonder if it has something to do with the version of tensorflow and other dependencies. Can you please mention the system configuration and the version numbers of all the libraries for which this tutorial works? Then I can try to replicate the same. Also, I am on a 64 bit Ubuntu 16.04, if that makes any difference.

Thanks

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.