You will need Robosherlock http://robosherlock.org/installation.html Using this as the library to use tensorflow models: https://github.com/serizba/cppflow/tree/cppflow2
Install the TF C API globally: https://serizba.github.io/cppflow/installation.html#install-the-tf-c-api-globally
You can also install the TF C API in a custom directory:
- https://www.tensorflow.org/install/lang_c download the linux CPU only (not tested with GPU support yet)
- mkdir -p ~/libtensorflow2/ && tar -C ~/libtensorflow2/ -xzf (downloaded file)
- sudo ldconfig
- export LIBRARY_PATH=$LIBRARY_PATH:~/libtensorflow2/lib
- export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/libtensorflow2/lib
Step 4 & 5 can be also done in the CMakeLists.txt
$ rosrun robosherlock runAAE _ae:=tensor_low_level
Check out the following tutorial for reference: https://serizba.github.io/cppflow/examples.html#inference-on-efficientnet
import tensorflow as tf
model = tf.keras.applications.EfficientNetB0()
# Export the model to a SavedModel
model.save('model', save_format='tf')