Skip to content

Commit

Permalink
Merge pull request #5 from NVIDIA-ISAAC-ROS/release-dp
Browse files Browse the repository at this point in the history
Isaac ROS 0.10.0 (DP)
  • Loading branch information
hemalshahNV authored Jul 1, 2022
2 parents 991605d + 0b90d49 commit 1d7abfe
Show file tree
Hide file tree
Showing 20 changed files with 431 additions and 502 deletions.
16 changes: 9 additions & 7 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,24 @@
*.jpg filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.psd filter=lfs diff=lfs merge=lfs -text

# Archives
*.gz filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text

# Documents
*.pdf filter=lfs diff=lfs merge=lfs -text
# Numpy data
*.npy filter=lfs diff=lfs merge=lfs -text
# Debian package
*.deb filter=lfs diff=lfs merge=lfs -text

# Shared libraries
*.so filter=lfs diff=lfs merge=lfs -text
*.so.* filter=lfs diff=lfs merge=lfs -text
# PCD files
*.pcd filter=lfs diff=lfs merge=lfs -text
# Model files

# ROS Bags
**/resources/**/*.db3 filter=lfs diff=lfs merge=lfs -text
**/resources/**/*.yaml filter=lfs diff=lfs merge=lfs -text

# DNN Model files
*.onnx filter=lfs diff=lfs merge=lfs -text
.trt filter=lfs diff=lfs merge=lfs -text
*.trt filter=lfs diff=lfs merge=lfs -text
Expand Down
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Ignore all pycache files
**/__pycache__/**
build/
install/
install_aarch64/
log/

# Ignore TensorRT plan files
*.plan
*.engine
551 changes: 154 additions & 397 deletions README.md

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions docs/training-detectnet-model-in-sim.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## Training a model using simulation

There are multiple ways to train your own `Detectnet_v2` base model. Note that you will need to update parameters, launch files, and more to match your specific trained model.

### Use the TAO toolkit launcher
The `Train and Optimize` tookit from NVIDIA has all the tools you need to prepare a dataset and re-train a detector with an easy to follow Jupyter notebook tutorial.

1. Install the `tao` command line utilities
```bash
pip3 install jupyterlab nvidia-pyindex nvidia-tao
```
2. Obtain an [NGC API key](https://ngc.nvidia.com/setup/api-key).
3. Install and configure `ngc cli` from [NVIDIA NGC CLI Setup](https://ngc.nvidia.com/setup/installers/cli).
```bash
wget -O ngccli_linux.zip https://ngc.nvidia.com/downloads/ngccli_linux.zip && unzip -o ngccli_linux.zip && chmod u+x ngc && \
md5sum -c ngc.md5 && \
echo "export PATH=\"\$PATH:$(pwd)\"" >> ~/.bash_profile && source ~/.bash_profile && \
ngc config set
```
4. Download the TAO cv examples to a local folder
```bash
ngc registry resource download-version "nvidia/tao/cv_samples:v1.3.0"
```
5. Run the `DetectNet_v2` Jupyter notebook server.
```bash
cd cv_samples_vv1.3.0 && jupyter-notebook --ip 0.0.0.0 --port 8888 --allow-root
```
6. Navigate to the DetectNet v2 notebook in `detectnet_v2/detectnet_v2.ipynb` or go to
```
http://0.0.0.0:8888/notebooks/detectnet_v2/detectnet_v2.ipynb
```
And follow the instructions on the tutorial.

### Training object detection in simulation

If you wish to generate training data from simulation using 3D models of the object classes you would like to detect, consider following the tutorial [Training Object detection from Simulation](https://docs.nvidia.com/isaac/doc/tutorials/training_in_docker.html).

The tutorial will use simulation to create a dataset that can then be used to train a `DetectNet_v2` based model. It's an easy to use tool with full access to customize training parameters in a Jupyter notebook.
Once you follow through the tutorial, you should have an `ETLT` file in `~/isaac-experiments/tlt-experiments/experiment_dir_final/resnet18_detector.etlt`.
Consult the spec file in `~/isaac-experiments/specs/isaac_detect_net_inference.json` for the values to use in the following section when preparing the model for usage with this package.
### Using the included dummy model for testing
In this package, you will find a pre-trained DetectNet model that was trained solely for detecting tennis balls using the described simulation method. Please use this model only for verification or exploring the pipeline.
> **Note**: Do not use this tennis ball detection model in a production environment.
You can find the `ETLT` file in `isaac_ros_detectnet/test/dummy_model/detectnet/1/resnet18_detector.etlt` and use the ETLT key `"object-detection-from-sim-pipeline"`, including the double quotes.
```bash
export PRETRAINED_MODEL_ETLT_KEY=\"object-detection-from-sim-pipeline\"
```
13 changes: 9 additions & 4 deletions isaac_ros_detectnet/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ message( STATUS "Architecture: ${ARCHITECTURE}" )

add_library(nvdsinfer_dbscan SHARED IMPORTED)
if( ${ARCHITECTURE} STREQUAL "x86_64" )
set_property(TARGET nvdsinfer_dbscan PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dbscan/x86_64_cuda_11_4/libnvds_dbscan.so)
set_property(TARGET nvdsinfer_dbscan PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dbscan/x86_64/libnvds_dbscan.so)
elseif( ${ARCHITECTURE} STREQUAL "aarch64" )
set_property(TARGET nvdsinfer_dbscan PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dbscan/jetpack46_1/libnvds_dbscan.so)
set_property(TARGET nvdsinfer_dbscan PROPERTY IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/dbscan/jetpack50/libnvds_dbscan.so)
endif()


Expand All @@ -45,8 +45,8 @@ target_compile_definitions(detectnet_decoder_node
)
target_link_libraries(detectnet_decoder_node nvdsinfer_dbscan)

rclcpp_components_register_nodes(detectnet_decoder_node "isaac_ros::detectnet::DetectNetDecoderNode")
set(node_plugins "${node_plugins}isaac_ros::detectnet::DetectNetDecoderNode;$<TARGET_FILE:detectnet_decoder_node>\n")
rclcpp_components_register_nodes(detectnet_decoder_node "nvidia::isaac_ros::detectnet::DetectNetDecoderNode")
set(node_plugins "${node_plugins}nvidia::isaac_ros::detectnet::DetectNetDecoderNode;$<TARGET_FILE:detectnet_decoder_node>\n")

install(TARGETS detectnet_decoder_node
ARCHIVE DESTINATION lib
Expand Down Expand Up @@ -75,6 +75,11 @@ install(PROGRAMS
DESTINATION lib/${PROJECT_NAME}
)

install(DIRECTORY
resources/rosbags/detectnet_rosbag
DESTINATION share/${PROJECT_NAME}
)

ament_auto_package(INSTALL_TO_SHARE launch)

find_package(vision_msgs REQUIRED)
3 changes: 3 additions & 0 deletions isaac_ros_detectnet/dbscan/x86_64/libnvds_dbscan.so
Git LFS file not shown
3 changes: 0 additions & 3 deletions isaac_ros_detectnet/dbscan/x86_64_cuda_11_4/libnvds_dbscan.so

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
*
* NVIDIA CORPORATION and its licensors retain all intellectual property
* and proprietary rights in and to this software, related documentation
Expand All @@ -15,10 +15,12 @@
#include <string>
#include <vector>

#include "isaac_ros_nvengine_interfaces/msg/tensor_list.hpp"
#include "isaac_ros_tensor_list_interfaces/msg/tensor_list.hpp"
#include "vision_msgs/msg/detection2_d_array.hpp"
#include "rclcpp/rclcpp.hpp"

namespace nvidia
{
namespace isaac_ros
{
namespace detectnet
Expand All @@ -38,13 +40,11 @@ class DetectNetDecoderNode : public rclcpp::Node
* @param tensor_list_msg The TensorList msg representing the detection list output by DetectNet
*/
void DetectNetDecoderCallback(
const isaac_ros_nvengine_interfaces::msg::TensorList::ConstSharedPtr tensor_list_msg);
const isaac_ros_tensor_list_interfaces::msg::TensorList::ConstSharedPtr tensor_list_msg);

// Queue size of subscriber
int queue_size_;

// Frame id that the message should be in
std::string header_frame_id_;
// A list of class labels in the order they are used in the model
std::vector<std::string> label_names_;
// coverage threshold to discard detections.
Expand All @@ -65,7 +65,8 @@ class DetectNetDecoderNode : public rclcpp::Node
int clustering_algorithm_;

// Subscribes to a Tensor that will be converted to a detection list
rclcpp::Subscription<isaac_ros_nvengine_interfaces::msg::TensorList>::SharedPtr tensor_list_sub_;
rclcpp::Subscription<isaac_ros_tensor_list_interfaces::msg::TensorList>::SharedPtr
tensor_list_sub_;

// Publishes the processed Tensor as an array of detections (Detection2DArray)
rclcpp::Publisher<vision_msgs::msg::Detection2DArray>::SharedPtr detections_pub_;
Expand All @@ -75,5 +76,6 @@ class DetectNetDecoderNode : public rclcpp::Node

} // namespace detectnet
} // namespace isaac_ros
} // namespace nvidia

#endif // ISAAC_ROS_DETECTNET__DETECTNET_DECODER_NODE_HPP_
17 changes: 8 additions & 9 deletions isaac_ros_detectnet/launch/isaac_ros_detectnet.launch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
Expand All @@ -21,43 +21,42 @@ def generate_launch_description():
encoder_node = ComposableNode(
name='dnn_image_encoder',
package='isaac_ros_dnn_encoders',
plugin='isaac_ros::dnn_inference::DnnImageEncoderNode',
plugin='nvidia::isaac_ros::dnn_inference::DnnImageEncoderNode',
parameters=[{
'network_image_width': 640,
'network_image_height': 368,
'network_image_encoding': 'rgb8',
'network_normalization_type': 'positive_negative',
'tensor_name': 'input_tensor'
'network_image_height': 368
}],
remappings=[('encoded_tensor', 'tensor_pub')]
)

triton_node = ComposableNode(
name='triton_node',
package='isaac_ros_triton',
plugin='isaac_ros::dnn_inference::TritonNode',
plugin='nvidia::isaac_ros::dnn_inference::TritonNode',
parameters=[{
'model_name': 'detectnet',
'model_repository_paths': ['/tmp/models'],
'input_tensor_names': ['input_tensor'],
'input_binding_names': ['input_1'],
'input_tensor_formats': ['nitros_tensor_list_nchw_rgb_f32'],
'output_tensor_names': ['output_cov', 'output_bbox'],
'output_binding_names': ['output_cov/Sigmoid', 'output_bbox/BiasAdd'],
'output_tensor_formats': ['nitros_tensor_list_nhwc_rgb_f32'],
'log_level': 0
}])

detectnet_decoder_node = ComposableNode(
name='detectnet_decoder_node',
package='isaac_ros_detectnet',
plugin='isaac_ros::detectnet::DetectNetDecoderNode',
plugin='nvidia::isaac_ros::detectnet::DetectNetDecoderNode',
parameters=[config]
)

container = ComposableNodeContainer(
name='detectnet_container',
namespace='detectnet_container',
package='rclcpp_components',
executable='component_container',
executable='component_container_mt',
composable_node_descriptions=[encoder_node, triton_node, detectnet_decoder_node],
output='screen'
)
Expand Down
41 changes: 41 additions & 0 deletions isaac_ros_detectnet/launch/isaac_ros_detectnet_demo.launch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright (c) 2021-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA CORPORATION and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.

import os

from ament_index_python.packages import get_package_share_directory
from launch import actions, LaunchDescription
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node


def generate_launch_description():
my_package_dir = get_package_share_directory('isaac_ros_detectnet')
return LaunchDescription([
actions.ExecuteProcess(
cmd=['ros2', 'bag', 'play', '-l',
os.path.join(my_package_dir, 'detectnet_rosbag')]
),
IncludeLaunchDescription(
PythonLaunchDescriptionSource([os.path.join(
my_package_dir, 'launch'),
'/isaac_ros_detectnet.launch.py'])
),
Node(
package='isaac_ros_detectnet',
executable='isaac_ros_detectnet_visualizer.py',
name='detectnet_visualizer'
),
Node(
package='rqt_image_view',
executable='rqt_image_view',
name='image_view',
arguments=['/detectnet_processed_image']
)
])
6 changes: 3 additions & 3 deletions isaac_ros_detectnet/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
<license>NVIDIA Isaac ROS Software License</license>
<url type="website">https://developer.nvidia.com/isaac-ros-gems/</url>
<author>Herón Ordóñez Guillén</author>
<author>Jay Monga</author>

<buildtool_depend>ament_cmake</buildtool_depend>
<buildtool_depend>ament_cmake_python</buildtool_depend>

Expand All @@ -30,14 +32,12 @@ license agreement from NVIDIA CORPORATION is strictly prohibited.
<depend>rclcpp_components</depend>
<depend>vision_msgs</depend>
<depend>isaac_ros_dnn_encoders</depend>
<depend>isaac_ros_nvengine_interfaces</depend>
<depend>isaac_ros_tensor_list_interfaces</depend>

<test_depend>ament_lint_auto</test_depend>
<test_depend>ament_lint_common</test_depend>
<test_depend>isaac_ros_test</test_depend>
<test_depend>isaac_ros_nvengine</test_depend>

<exec_depend>isaac_ros_nvengine</exec_depend>
<exec_depend>isaac_ros_triton</exec_depend>

<export>
Expand Down
30 changes: 30 additions & 0 deletions isaac_ros_detectnet/resources/detectnet_sample_config.pbtxt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: "detectnet"
platform: "tensorrt_plan"
max_batch_size: 16
input [
{
name: "input_1"
data_type: TYPE_FP32
format: FORMAT_NCHW
dims: [ 3, 368, 640 ]
}
]
output [
{
name: "output_bbox/BiasAdd"
data_type: TYPE_FP32
dims: [ 8, 23, 40 ]
},
{
name: "output_cov/Sigmoid"
data_type: TYPE_FP32
dims: [ 2, 23, 40 ]
}
]
dynamic_batching { }
version_policy: {
specific {
versions: [ 1 ]
}
}

Git LFS file not shown
Git LFS file not shown
Loading

0 comments on commit 1d7abfe

Please sign in to comment.