Multiple model Inference And Runtime Model Switching

I want to perform inference using multiple models in my design on Jetson devices.
I came across this issue here, but it only addresses the scenario of multiple inputs for a single model.
I found that the Triton server has the capability of loading multiple models into the GPU simultaneously, but the “triton_node” only accepts a single const std::string model_name_.

I have the following questions that I would be grateful if someone could answer:
1- Should I create multiple TensorRT or Triton server engines in my ROS environment? Is it even possible or recommended?

In another scenario, I would like to switch between different models at runtime.

2- Since the model_name is provided as a parameter, is it possible to switch between different models at runtime without shutting down the DNN node? If not, what is the proper way of switching between models?

Following this link and this link it seems like running tensorrt engine in multiprocess create two context and two context get scheduled in time slice fashion cause inference time to increase. so should i create a composable node out of all tensorrt engines so they created in multithreading mode and not multiprocessing ?
But in Nvidia github here, they simply run two launch files (stereo and unet) as seperate nodes. isn’t it cause a time slice problem ?!

Hi @hshh

Welcome to the Isaac ROS forum.

I’m forwarding your issue to the engineering for a more detailed reply.

Following the GitHub - NVIDIA-AI-IOT/Nav2-with-Isaac-ROS-GEMs doesn’t cause time problem that you can evaluate running this demo

1 Like

I’m back

Yes, for each TensorRtInference node or TritonInference node can be launched and loaded with a single model.

In order to run inference on multiple models, you will need multiple instances of nodes configured with different models and graph flow tools (see topic_tools) to direct the traffic.

1 Like

Thanks for the reply Raffaello

Actually I was trying to launch multiple Inference nodes one day and didn’t succeeded, I will try it again today!

It is fun though I follow almost every useful ROS package but i never stumbled upon the topic_tools you mentioned! Thanks for mentioning it. I will be check the link you mentioned today and come back to you soon.

So you mean that If i launch multiple inference nodes in a graph they don’t cause the multiprocessing time slice problem due to multiple contexts that occur when launching tensortrt from multiple processes?

And it would be “VERY GREAT” if all isaac_ros nodes are updated to become ros2 lifecycle nodes instead of normal nodes. cause right now in my design if i wanna change the inference model I should kill the inference node and launch it again with different model if it become a lifecycle node I can simply transition it to inactive, change the model and then again transition it to active and the node automatically reloads the model into GPU.