We needed to execute some pretrained Tensorflow models in C++ on our robot, and found this task to be pretty difficult to get it right. For Python inference, it’s just
<depend>python-tensorflow-pip</depend> and that’s it.
So we wrote a support package tensorflow_ros_cpp which is a facade hiding the complicated stuff and allowing you to “just”
<depend>tensorflow_ros_cpp</depend> and that’s it. An example of use is shown in package tensorflow_ros_test.
The package supports several ways of Tensorflow installation:
- It can “steal” from the files installed by Python’s pip, so just installing Tensorflow via pip is enough to get the C++ API! (though it has some problems on newer systems).
- It supports tensorflow_catkin
- It supports custom builds using bazel
The good thing is that by depending on
tensorflow_ros_cpp you don’t force users of your package into any specific kind of Tensorflow installation, he can freely choose, and your code stays the same (again, except for the systems with C++ ABI problems).
By nature of this package, it will never be distributed as a binary package, it always needs to be compiled from source.
Let us know if you find it useful!