bitbionic / keras-to-tensorflow Goto Github PK
View Code? Open in Web Editor NEWA tutorial on running Keras models in Tensorflow
License: MIT License
A tutorial on running Keras models in Tensorflow
License: MIT License
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!
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.
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?
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.
Please help me to solve this. Thanks.
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.
Hi - Thanks for this implementation. Does this have support for GPU?
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!
Can you provide a example code of yolov3 c++ inference with tensorflow?
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.
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.