Issues loading a .pb file generated using python
See original GitHub issueDescribe the bug
I receive an Invalid Graphdef
exception when attempting to import a pb file I have successfully saved, and loaded, using python.
I’ve created a repo with some code to get you started. Just run the application. The python scripts are there too.
To Reproduce Please see the repo
The build steps are in the readme, open the sln and hit F5
and you should be up and running.
Get back to me here if that somehow doesn’t work. (make sure you’re targetting x64).
Expected behavior I expect the model to load.
Failing that instructions / examples on how to save a model in python to get it to work with TensorflowSharp would be ideal.
Desktop (please complete the following information):
- OS: Windows 10
- Version 10.0.17134 Build 17134
Issue Analytics
- State:
- Created 5 years ago
- Comments:12
Top Results From Across the Web
tensorflow2 problem of loading pb file to predict
Currently, I'm using tf2.3 and windows 10 for learning siamese network. The training processing had no problem. I saved the model in pb...
Read more >Using the SavedModel format
You can load the SavedModel back into Python with tf.saved_model.load and see ... The saved_model.pb file stores the actual TensorFlow program, or model, ......
Read more >How to Restore a TensorFlow Model from a pb File in Python
The first step is to import the required libraries. You will need TensorFlow and NumPy libraries to restore the model from the .pb...
Read more >Can not load .pb model into Labview 2018 - NI Community
I am trying to load my model which is trained by SVM and using HOG to extract feature. I also used torch to...
Read more >Protocol Buffer Basics: Python
This tutorial provides a basic Python programmers introduction to working with protocol buffers.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@DinoSourcesRex
You need to use TFSession.FromSavedModel Look here
@DinoSourcesRex You are correct and you have to use it to save your model. But saved_model saves all the check points and graph and weights separately. To use the graph in TensorflowSharp you need to freeze checkpoints, graphdefs and weights all together in a .pb file using freeze_graph.py or you can write your own code and then you can use it correctly. This blog explains it very nicely how to freeze a model and deploy it in python API and you can do the same for TensorflowSharp API. I used the given example in both python and C# and it worked. I would recommend you to try this first and then you can use it for your own model.