darknet_ros
darknet_ros copied to clipboard
Slow detections because a detection image is generated even when there are no subscribers
Describe the bug On these lines the detection image is generated and significantly slows down the detection speed since it is copying pixels in an image with a for loop. This doesn't need to occur at this stage and can be moved after it is checked if anyone is subscribing to the detection topic (here).
To Reproduce Steps to reproduce the behavior:
- Run darknet_ros
Expected behavior The detection image should not be generated unless there are subscribers.
System specs (please complete the following information):
- OS Ubuntu 20.04
- ROS version: Foxy
- Library versions when non-standard
- GPU / CUDA version when relevant
Additional context I've tested this locally on a fork of PR #319. It increases the FPS from a max of 120 to 150, along with the average FPS being higher.