Tensorflow 2.x C++ API for object detection (inference)

Serving Tensorflow Object Detection models in C++

Raktim Bora
3 min readOct 3, 2020
Photo by Anoir Chafik on Unsplash

In a recent project, I had to integrate an object detection model into an existing C++ application code base for inferencing. This meant creating a C++ inferencing wrapper for our model which was trained in Python and serialized as TensorFlow binary checkpoints. We were on the latest stable release v2.3 of Tensorflow and were also using the Tensorflow Object detection API v2 which was recently upgraded to be compatible with Tensorflow 2.x.

This seemingly straight forward task took me a good few days and raising a couple of issues on Tensorflow Github repo, mainly because building Tensorflow C++ API from source is still painful and the lack of documentation around the usage of C++ API means you have to figure out things the hard way. If you are attempting the same, this article might save you some time and agony.

Oh btw, this article is mostly code, so you can view them directly on Github if that’s the sort of the thing you like.

--

--

Raktim Bora

Currently building camhero.app. I explain concepts on AI, Deep Learning, Computer Vision, Python, C++ with an easy hands-on and intuitive style