Skip to main content

TF 1.13.1 Inference From Model Frozen in Python [Working]

 In Visual Studio 2017:



Download contents from:
https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-gpu-windows-x86_64-1.13.1.zip

This has the prebuilt binaries for C - doesn't work for C++:
We use the one with GPU support but you can download cpu only as well.

We extract it in C:\libtensorflow-gpu-windows-x86_64-1.13.1

Then:
Set Debug mode to x64


Then go to Project >> Properties and:

In VC++ Directories add path:

C:\libtensorflow-gpu-windows-x86_64-1.13.1 in Include Directories and Library Directories

In Linker >> Input add:

tensorflow.lib in Additional Dependencies

By default the project creates cpp file, so go to Source Files and rename the main file to *.c

For example: catdogtest.cpp to catdogtest.c

If you get library missing error make sure you've added correct paths in VC++ Directories and Linker

You should copy tensorflow.dll from C:\libtensorflow-gpu-windows-x86_64-1.13.1 to project source files directory and add it to source files by right clicking it and add existing item >> tensorflow.dll

In the graph_def_filename put the frozen graph path:

Ex: F:/catdog/python/freeze_outputs/frozen_graph_39.pb


Source Code Available for C: https://drive.google.com/drive/folders/1JhBkAgz45qTxWyV6rMAn8G0hQgpRC1ge?usp=sharing