isaac_ros_dnn_image_encoder
Source code on GitHub.
Note
This package mainly exists to preserve functionality from prior releases. Instead, we recommend individually including each node that is required currently. An example can be found in the launch files found in Isaac ROS RT-DETR.
Migration Guide
As of Isaac ROS 3.0, the DnnImageEncoderNode
is deprecated and replaced with a launch file that performs the same functionality
as the original node, with some minor caveats. This decision was made to allow for better composition of nodes that each perform
some preprocessing. For example, for one model, the preprocessing sequence may involve resizing and normalizing an image,
whereas another model may expect only resizing.
This guide explains how to migrate a DNN from our old DNNImageEncoderNode
to our new launch file.
Open a launch file where the
DNNImageEncoderNode
is used. We assume that your launch file has code that looks along the lines of:encoder_node = ComposableNode( name='encoder_node', package='isaac_ros_dnn_image_encoder', plugin='nvidia::isaac_ros::dnn_inference::DnnImageEncoderNode', parameters=[{ 'input_image_width': input_image_width, 'input_image_height': input_image_height, 'network_image_width': network_image_width, 'network_image_height': network_image_height, 'image_mean': encoder_image_mean, 'image_stddev': encoder_image_stddev, 'num_blocks': num_blocks, }], remappings=[ ('encoded_tensor', 'tensor_pub'), ('image', 'img'), ], )Import relevant
launch
libraries to allow for including thednn_image_encoder.launch.py
launch description:from ament_index_python.packages import get_package_share_directory from launch.actions import IncludeLaunchDescription from launch.launch_description_sources import PythonLaunchDescriptionSourceGo to the section where the
encoder_node
is defined and replace it with:encoder_dir = get_package_share_directory('isaac_ros_dnn_image_encoder') encoder_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( [os.path.join(encoder_dir, 'launch', 'dnn_image_encoder.launch.py')] ), launch_arguments={ 'input_image_width': input_image_width, 'input_image_height': input_image_height, 'network_image_width': network_image_width, 'network_image_height': network_image_height, 'image_mean': encoder_image_mean, 'image_stddev': encoder_image_stddev, 'attach_to_shared_component_container': 'True', 'component_container_name': 'my_container', 'dnn_image_encoder_namespace': 'my_encoder_namespace', 'image_input_topic': '/image', 'camera_info_input_topic': '/camera_info', 'tensor_output_topic': '/tensor_pub', }.items(), )The topic names contain a / in front of them to ensure that they are not apart of the namespace passed in. Additionally, we configure the encoder to attach to a shared component container called
my_container
. Ensure that the correct global name is passed to thecomponent_container_name
, otherwise the launch will silently fail.
Finally, launch the included launch description. An example is shown below:
final_launch_container = launch_args + [rclcpp_container, encoder_launch] return LaunchDescription(final_launch_container)
Note
The new DNN image encoder expects to subscribe to a CameraInfo topic in addition to an Image topic.
API
dnn_image_encoder.launch.py
Launch Arguments
Launch Argument |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The input image width. |
|
|
|
The input image height. |
|
|
|
The image width that the network expects. This will be used to crop the input |
|
|
|
The image height that the network expects. This will be used to crop the input |
|
|
|
The mean of the images per channel that will be used for normalization. |
|
|
|
The standard deviation of the images per channel that will be used for normalization. |
|
|
|
The number of pre-allocated GPU memory blocks |
|
|
|
Whether to enable padding or not |
|
|
|
Whether to maintain the aspect ratio or not while resizing |
|
|
|
The crop mode to crop the image using |
|
|
|
The desired image format encoding |
|
|
|
The tensor name of the output of the image encoder |
|
|
|
The namespace to launch the DNN image encoder under |
Launch Configuration Arguments
Launch Configuration |
Type |
Default |
Description |
---|---|---|---|
|
|
|
The input image topic that the encoder will subscribe to. By default, this will
be under the |
|
|
|
The input camera_info topic that the encoder will subscribe to. By default, this will
be under the |
|
|
|
The output tensor topic that the encoder will publish to. By default, this will
be under the |
|
|
|
Whether to attach to an existing shared container or not |
|
|
|
If |
Included Nodes
Component Name |
---|