Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load checkpoint and inference with C++ for tensorflow?

I have Tensorflow with python api and got these checkpoint model file:

model.ckpt-17763.data-00000-of-00001
model.ckpt-17763.index
model.ckpt-17763.meta

But I want a C/C++ shared library (.so file) when integrating into production. So I need to load these model file and inference with C++ code and compile to a shared library. Is there some tutorial or sample for doing this?

like image 841
tidy Avatar asked Jun 13 '17 03:06

tidy


1 Answers

You can write c++ code to load and use your graph with the instructions given here.

You can use the files here to make a Cmake project with tensorflow outside the TF repository, and compile your library.

However, you'll still need the .ckpt files next to your .so, I don't know how to intergate them inside it.

There are a lot of questions about that on S.O., and a few tutorials (see the two cited in this answer) but since tensorflow is evolving fast, they quickly become outdated, and it's always a bit of struggle to get it to work properly (totally feasible, and getting easier, though).

like image 127
gdelab Avatar answered Oct 29 '22 08:10

gdelab