dusty-nv / ros_deep_learning

Deep learning inference nodes for ROS / ROS2 with support for NVIDIA Jetson and TensorRT
879 stars 257 forks source link

multiple cameras #34

Open qwedaq opened 4 years ago

qwedaq commented 4 years ago

Hi , I wanted to know how do I launch detectnet node for multiple camera images at the same time. I have 4 camera image topics with me but how can I run object detection node on all the images at the same time. I am a beginner to this , can you please help me?

Thanks in advance

r91andersson commented 3 years ago

What I've found out to work was to modify the code inside node_detectnet.cpp. In my case I have 3 camera live feed I want to run detection on, so what I did was to add 2 more subscribers (basically just copy paste the first subscriber). ROS_GET_PARAMETER("topic_image_in_camera_1", topic_image_in_camera_1); ROS_GET_PARAMETER("topic_image_in_camera_2", topic_image_in_camera_2); ROS_GET_PARAMETER("topic_image_in_camera_3", topic_image_in_camera_3);

Then,

` /*

They will all use the same model to run the inference on. i.e they all call this: const int numDetections = net->Detect(input_cvt->ImageGPU(), input_cvt->GetWidth(), input_cvt->GetHeight(), &detections, detectNet::OVERLAY_NONE);

However, I'm not sure if there is any guarantee that a specific callback will have the resource to the detection model and be able to run the inference? Maybe you know this @dusty-nv. Will it be a blocking/wait call if the resource (detection model) is already taken by another thread (callback)?

dusty-nv commented 3 years ago

Will it be a blocking/wait call if the resource (detection model) is already taken by another thread (callback)? Yes detectNet::Detect() is a blocking call

r91andersson commented 3 years ago

Ok, so if one thread is using the model and blocking the resource, will the other thread wait until the resource becomes free, or will it continue execute?

dusty-nv commented 3 years ago

Another thread should be able to use it, but I haven't tested that scenario.

From: r91andersson @.> Sent: Monday, May 3, 2021 9:32 AM To: dusty-nv/ros_deep_learning @.> Cc: Dustin Franklin @.>; Mention @.> Subject: Re: [dusty-nv/ros_deep_learning] multiple cameras (#34)

Ok, so if one thread is using the model and blocking the resource, will the other thread wait until the resource becomes free, or will it continue execute?

- You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/dusty-nv/ros_deep_learning/issues/34#issuecomment-831261217, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ADVEGK7QH6AOYASFHSUD7Z3TL2QT3ANCNFSM4MKUTM3A.