Ask Your Question
0

Why tensorflow python3 script runs slower in ROS than standalone?

asked 2019-07-29 12:16:21 -0500

npscars gravatar image

updated 2019-07-29 17:02:22 -0500

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-10-20 11:53:44 -0500

npscars gravatar image

I found out the reason why this was happening was because the image size input to python3 directly was a bit smaller than the input to ros node. Sorry for confusion but thought would be still useful for someone who might experience this issue like me.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2019-07-29 12:14:02 -0500

Seen: 51 times

Last updated: yesterday