darknet_ros icon indicating copy to clipboard operation
darknet_ros copied to clipboard

Last image stuck in detection loop

Open Cuky88 opened this issue 7 years ago • 5 comments

When testing darknet_ros with recorded rosbags, we encounter the following problem:

  1. Running darknet rosnode is fine, the net will be initialized and then the message "Waiting for image" will be printed.
  2. As soon as I run the rosbag, darknet receives the image and does the inference and publishes the messages as it should
  3. When I stop the rosbag, than darknet will always run the net on the last received image in loop. There will be no message like "Waiting for image" since the while-block will be not left, unless the rosnode is closed - which is not.

This beaviour is very bad. We use several cameras but it can happen that at some time no camera is recording, so darknet would do inference on the last image. Thus, it will alway publish the same bounding boxes until new images arrive.

Did anyone else encounter this problem? How can you fix the node, so that if no new image arrives, darknet just prints "Waiting for image" and only waits?

Thx.

Cuky88 avatar Apr 17 '18 17:04 Cuky88

I am also encountering this problem. I am about to look into it, but it seems as if darknet is constantly grabbing the last received image.

RhysMcK avatar Jul 05 '18 01:07 RhysMcK

Is there any progress towards solving this problem ? I have found various posts which all point towards darknet running at full speed even when the image has not been updated. I also found that the bounding boxes message is received repeatedly with the same frame_id, in the image header, and identical bounding boxes. This is wasting a lot of GPU. Could darknet store the frame id and not run the NN until a new frame is received ?

elpidiovaldez avatar Jul 04 '19 04:07 elpidiovaldez

I have made a fix which seems to solve the problem, but I still have not worked out how to publish it through Github.

elpidiovaldez avatar Jul 08 '19 00:07 elpidiovaldez

I have made a fix which seems to solve the problem, but I still have not worked out how to publish it through Github. Can you share your repo? I am facing the same issue @elpidiovaldez please..

Vishwajeetiitb avatar Jan 09 '21 11:01 Vishwajeetiitb

@Cuky88 Hi there. I'm trying to run darknet_ros also with a pre-recorded ros-bag. Can you explain how do you achieved inference on the images? When I ran darknet inference is done correctly, but with darknet-ros no object is detected (All done on the same bag). I'm using GPU=1 and getting 65~70 fps on the darknet-ros node. Thank you.

dcaneco avatar Jul 18 '22 23:07 dcaneco