-1

For my master's thesis, I will have to do an inference with a pre-built / pre-trained (with TensorFlow) deep neural network model. I received it in two different formats (hdf5 / h5 and frozen graph = .pb). The inference shall be done on a cluster, so far we only have a GPU-version (with TensorRT and a uff Model) running. So my first job seems to be to do inference on one CPU before making a usage possible on the cluster.

We are using the model within computational fluid dynamics (CFD) simulations – that is also my academic background, and as you can therefore imagine I have only a little knowledge about deep learning. Anyway, it is not my job to change/train the model but just to use it for inference. Our CFD-Code is written in C++, which is the only programming language I am using on an advanced level (obviously it is no problem to use C, but I have no idea of python).

After going through many Google searches I recognized that I do not have a real idea how to start things off. I thought it would be possible to skip all the training and TensorFlow stuff. I know how neural networks work and how they calculate their output values from their input values. I also have the most important theoretical knowledge, but no programming knowledge in this field. Is it somehow possible to use the model they gave me (so either hdf5/h5 or frozen graph) and build an inference code using exclusively C or C++? I already found the C API and installed it within a docker container (where I also have Tensorflow), but I am really not sure what the next step is. What can I do with the C API? How would you write a C/C++-Code for inference with a DNN-model that is prepared to inference with it?

Shayan Shafiq
  • 1,447
  • 5
  • 18
  • 25
tre95
  • 433
  • 5
  • 16
  • 1
    Look for examples of tensorflow/python/C-inegration and learn from there. – Paul Ogilvie Apr 12 '19 at 12:50
  • 3
    There is no such language as `C/C++`. Pick one or address the differences regarding you question clearly. – Fureeish Apr 12 '19 at 12:50
  • According to this (https://github.com/tensorflow/tensorflow/issues/8033) using the C API is easier in this case, so I guess the code will also be in C. – tre95 Apr 12 '19 at 13:58
  • Examples here https://stackoverflow.com/questions/44378764/hello-tensorflow-using-the-c-api – Jon Nordby Apr 12 '19 at 18:27

1 Answers1

0

Opencv provided tools to run deep learning models but they are just limited to computer vision field. See here.

You can perform classification, object detection, face detection, text detection, segmentation, and so on by using the API provided by opencv. These examples are fairly straightforward.

There are both python version and c++ version available.

Community
  • 1
  • 1
Danny Fang
  • 3,843
  • 1
  • 19
  • 25