Skip to content

Slow detections because a detection image is generated even when there are no subscribers #364

@blakermchale

Description

@blakermchale

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:

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions