Why tensorflow python3 script runs slower in ROS than standalone?
Ubuntu 18.04 ROS Melodic Python 3.6.8 Tensorflow: 1.13.1 TensorRT: 5.1.5 NVIDIA: GTX1060 using Cudnn 7.6 and Cuda 10.0
When I run a object detection model developed in python using tensorflow framework in ros, the speed appears to be slower than if i run the same tensorflow model in pure python environment. Is this expected behaviour?
I tried tensorflow object detection model named "ssd_mobilenet_v2_coco_2018_03_29"
python3 tensorflow_inference.py
--> takes 16ms approx.
rosrun inference_node inference.py
--> takes 22ms approx
Just for information my catkin workspace is build with python3 too.
For example my model stats below
python3 tensorflow_inference.py
---> takes 60ms approximately
But
rosrun inference_node inference.py
and subscribing to an image broadcasted by a bag file --> takes 85ms approx.
This seems strange or I am missing some point.