Closed simo-lab closed 6 years ago
Hey @Pacana78
Which version of tensorflow are you using for importing and exporting the model?
Hey @mdietrichstein sorry for the late reply. I am using tf version 1.3.0
I can't seem to reproduce this problem with tensorflow 1.3.0.
I have exported the model with export_model.py
and imported it with tf.saved_model.loader.load
in another script. Didn't get any error...
Do you have some more details for me, e.g. the code you are using to import the model, python version, platform (Linux, Windows, ...)?
I'm using Python 2.7.12 inside a docker. Here's the version
Client: Version: 17.09.0-ce API version: 1.32 Go version: go1.8.3 OS/Arch: darwin/amd64
Server: Version: 17.09.0-ce API version: 1.32 (minimum version 1.12) Go version: go1.8.3 OS/Arch: linux/amd64 Experimental: true
After I've exported the model using export_model.py
, I use these instructions in Go to import the saved model
graph := tf.NewGraph()
if err := graph.Import(model, "ResNet_50_1by2_nsfw"); err != nil {
//here I get an Invalid GraphDef error
log.Fatal(err)
}
Thanks
Thanks for the additional information @Pacana78
I see now where the problem is. The export_model.py
script exported a SavedModel
which does not seem to be compatible for loading via graph.Import
.
I have added a new script (tools/export_graph.py
) which exports standard graphdef and checkpoint files.
Let me know if those work for you.
I run export_model.py and I've got a protobuf saved, but when I've tried to import the model with Tensorflow I got an "Invalid GraphDef" error.