question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues loading a .pb file generated using python

See original GitHub issue

Describe 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:open
  • Created 5 years ago
  • Comments:12

github_iconTop GitHub Comments

2reactions
alex-zucommented, Aug 21, 2018
2reactions
Shivanitiwarycommented, Aug 20, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found