4

This is probably a very basic question...

But how do I convert checkpoint files into a single .pb file. My goal is to serve the model using probably C++

These are the files that I'm trying to convert.

Checkpoints

As a side note I'm using tflearn with tensorflow.

Edit 1: I found an article that explains how to do this: https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc

The problem is that I'm stuck with the following error

KeyError: "The name 'Adam' refers to an Operation not in the graph."

How do I fix this?

Edit 2: Maybe this will shed some light on the problem.

Regression Layer

The error that I get comes from the regression layer, if I use: sgd. I'll get

KeyError: "The name 'SGD' refers to an Operation not in the graph."
redb
  • 512
  • 8
  • 22

1 Answers1

3

The tutorial on https://blog.metaflow.fr/tensorflow-how-to-freeze-a-model-and-serve-it-with-a-python-api-d4f3596b3adc works just fine.

The problem was that I was loading the model using tensorflow instead of using tflearn.

So... instead of:

tf.train.import_meta_graph(...)

We do:

model.load(...)

TFLearn knows how to parse the graph properly.

redb
  • 512
  • 8
  • 22
  • `model.load(...)?` can you explain more? – Morse May 04 '18 at 19:21
  • 1
    model.load(...) comes from TFLearn itself not Tensorflow. I was mixing the two APIs. – redb May 05 '18 at 00:20
  • Check here: http://tflearn.org/#quick-overview, in the first code example they create a model doing `model = tflearn.DNN(net)`. From that you can do `model.load` – redb May 06 '18 at 11:03
  • This one asks to build network from scratch, I wanted to keep model built by a program and later have a difference program just to call the model from predictions. Not getting easy way to just import these tflearn generated files(meta,index...) – Morse May 07 '18 at 17:01