Unable to receive ROS image messages from TensorFlow docker container

Unable to receive ROS image messages from TensorFlow docker container

I was using NVIDIA’s official TensorFlow docker container (R1.0) to perform object detection using a neural net. However, I cannot subscribe to ROS camera messages and therefore cannot get any input. The reason might be that the docker container requires using python3 for tensorflow, but ROS Kinetic only support python2. There is a python version mismatch and I got many errors related to opencv and cv_bridge.

Does anyone have any experience setting up TensorFlow and receiving ROS image topics at the same time?

The errors are as follows:

[ERROR] [1521770206.017362]: bad callback: <bound method image_converter.callback of <__main__.image_converter object at 0x7f926a0320>>
Traceback (most recent call last):
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)
  File "src/tensorflow_v6_gpu_docker.py", line 94, in callback
    cv_image = self.bridge.imgmsg_to_cv2(data, "bgr8")
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 163, in imgmsg_to_cv2
    dtype, n_channels = self.encoding_to_dtype_with_channels(img_msg.encoding)
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 99, in encoding_to_dtype_with_channels
    return self.cvtype2_to_dtype_with_channels(self.encoding_to_cvtype2(encoding))
  File "/opt/ros/kinetic/lib/python2.7/dist-packages/cv_bridge/core.py", line 91, in encoding_to_cvtype2
    from cv_bridge.boost.cv_bridge_boost import getCvType
ImportError: dynamic module does not define module export function (PyInit_cv_bridge_boost)

Dear jiaweih,

Can I know why you want to use TF docker container for ROS?
If the reason is for inferencing, could you please use TensorRT instead of TF docker? Thanks.

Hi, SteveNV.

Because TF is a well-rounded framework for both training and inference. Are you suggesting that one has to use TensorRT for inferencing on Drive PX2?? What if the particular model is not yet supported by TensorRT but is supported by TF?

Actually ROS + TF docker is a very natural combination and I am a little surprised why more people did not run into such issues.

Can you confirm that currently ROS + TF docker is not working on Drive PX2? At least I found cv_bridge is broken so I can’t subscribe to camera images.

Dear jiaweih,

DPX2 supports TensorRT for inferencing.
Could you refer to below link?
Optimizing Self-Driving DNNs on NVIDIA DRIVE PX with TensorRT : http://info.nvidia.com/drivepx-tensorrt-reg-page.html

Can I know which TF model you are using? Thanks.