The main idea behind this approach is to keep everything modular, thus, simple and organized. This way it relatively simple to do any changes needed to improve compatibility.
Here is a basic diagram to better illustrate how things are organized:
As you can see there are four main blocks. Let’s break them down:
This node only gets the image from the source and sends it through a ROS Topic
It’s a temporary node for tests and exemplification
This block consists of 2 sub-blocks: Inference Manager and Inference Solution.
Inference Manager: Gets all the data required to do the inference (image, model and model info) and sends to the Inference Solution. The result from the Inference Solution is sent through multiple ROS Topics
Inference Solution: Gets all the data needed and returns the inference result in a specific format
It’s done in PyTorch, but the modules can be done in any framework that uses tensors convertible to numpy arrays *Possible modification 1 (Unnecessary transformations)
Possible modification 1: Add a parameter for the model type (PyTorch, TorchScript, ONNX, OpenVINO, TensorRT, CoreML, TensorFlow SavedModel, TensorFlow GraphDef, TensorFlow Lite, TensorFlow Edge TPU, TensorFlow.js, PaddlePaddle or a custom one) and load the model in a module (increase compatibility)
Temporary: The model must be in TorchScript
Possible modification 1: Add a parameter for model type (PyTorch, TorchScript, ONNX, OpenVINO, TensorRT, CoreML, TensorFlow SavedModel, TensorFlow GraphDef, TensorFlow Lite, TensorFlow Edge TPU, TensorFlow.js, PaddlePaddle or a customized one) and load the model in a module (increase compatibility)
This is the node only gets the inference results from each ROS Topic and merge them with the original image.
It’s a temporary node for tests and exemplification