Skip to navigation

DeepStream 3D Lidar Inference App

View as Markdown

The deepstream-lidar-inference-app sample application is provided at app/sample_apps/deepstream-lidar-inference-app/ for your reference. The deepstream_lidar_inference_app provides an end-to-end inference sample for lidar pointcloud data. The sample application reads the point cloud data from dataset files and send the data to Triton Inferencing filter with PointPillarNet model, the inferencing result is the group of 3D bounding boxes of the objects. The sample application loads different pipelines based on different application config files. There are 2 pipelines configured in the sample app.

  1. Lidar Triton inference for 3D objects detection and file dump.
  2. Lidar Triton inference and 3D objects detection and GLES 3D rendering.

Inside these sample configurations, the inference model is a 3D TAO model based on PointPillar. For more details about PointPillar, see https://arxiv.org/abs/1812.05784.

TensorRT 8.5 has a bug for FP16 mode when converting this specific TAO model to TensorRT engine file. DeepStream fallback to FP32 mode for this release.

This is a snapshot for deepstream-lidar-inference-app running with lidar data inference objects detection and GLES 3D rendering with 3D bounding box display on screen.

DeepStream Lidar inference for 3D point cloud processing and rendering snapshot

Prerequisites

You must have the following development packages installed:

  • GStreamer-1.0
  • GStreamer-1.0 Base Plugins
  • X11 client-side library
  • libyaml-cpp-dev

To install these packages, execute the following command:

sudo apt-get install libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev \
libgstrtspserver-1.0-dev libx11-dev libyaml-cpp-dev

Lidar Point Cloud to 3D Point Cloud Processing and Rendering

The application can be configured as different pipelines according to the application configuration file.

  1. Lidar data inference and 3D bounding box dump pipeline:

This pipeline is from lidar point cloud, 3D point cloud inferencing, to the 3D objects data dump.

DeepStream Lidar inference for 3D point cloud processing overview

  • ds3d::dataloader loads custom lib libnvds_lidarfileread.so and creates a dataloader through the createLidarFileLoader function. This specific loader is configured by lidar dataset file list data_config_file. Gst-appsrc connects the dataloader into the deepstream pipeline.
name: lidarsource
type: ds3d::dataloader
out_caps: ds3d/datamap
custom_lib_path: libnvds_lidarfileread.so
custom_create_function: createLidarFileLoader
  • ds3d::datafilter loads custom lib libnvds_tritoninferfilter.so and creates a lidar point cloud Triton inferencing filter through the createLidarInferenceFilter function. For this specific configuration, The Lidar Triton filter inferences the point cloud data with TAO model PointPillarNet model and return the 3D bounding boxes around each object.
name: lidarfilter
type: ds3d::datafilter
in_caps: ds3d/datamap
out_caps: ds3d/datamap
custom_lib_path: libnvds_tritoninferfilter.so
custom_create_function: createLidarInferenceFilter

ds3d::datafilter is loaded by the nvds3dfilter Gst-plugin which accepts in_caps as sink_caps and out_caps as src_caps. It creates a custom ds3d::datafilter instance and processes data as ds3d/datamap.

  • ds3d::datarender loads custom lib libnvds_lidarfilewrite.so to dump the detected 3D bounding boxes to a file.
name: lidarrender
type: ds3d::datarender
in_caps: ds3d/datamap
custom_lib_path: libnvds_lidarfilewrite.so
custom_create_function: createLidarFileDataRender
  1. Lidar data inference and Lidar data rendering with 3D bounding box display pipeline:

This pipeline is from lidar point cloud data file, 3D point cloud inferencing, to the 3D point cloud rendering with colors.

DeepStream Lidar inference for 3D point cloud processing and rendering overview

  • ds3d::dataloader loads custom lib libnvds_lidarfileread.so and creates a dataloader through the createLidarFileLoader function. This specific loader is configured by lidar dataset file list data_config_file. Gst-appsrc connects the dataloader into the deepstream pipeline.
name: lidarsource
type: ds3d::dataloader
out_caps: ds3d/datamap
custom_lib_path: libnvds_lidarfileread.so
custom_create_function: createLidarFileLoader
  • ds3d::datafilter loads custom lib libnvds_tritoninferfilter.so and creates a lidar point cloud Triton inferencing filter through the createLidarInferenceFilter function. For this specific configuration, The Lidar Triton filter inferences the point cloud data with TAO model PointPillarNet model and return the 3D bounding boxes around each object.
name: lidarfilter
type: ds3d::datafilter
in_caps: ds3d/datamap
out_caps: ds3d/datamap
custom_lib_path: libnvds_tritoninferfilter.so
custom_create_function: createLidarInferenceFilter

ds3d::datafilter is loaded by the nvds3dfilter Gst-plugin which accepts in_caps as sink_caps and out_caps as src_caps. It creates a custom ds3d::datafilter instance and processes data as ds3d/datamap.

  • ds3d::datarender loads custom lib libnvds_3d_gl_datarender.so and creates GLES Lidar point cloud rendering context to display XYZI or XYZ lidar data and 3D bounding boxes with custom_create_function: createLidarDataRender.
name: lidarrender
type: ds3d::datarender
in_caps: ds3d/datamap
custom_lib_path: libnvds_3d_gl_datarender.so
custom_create_function: createLidarDataRender

Getting Started

Run Lidar Point Cloud Data File reader, Point Cloud Inferencing filter, and Point Cloud 3D rendering and data dump Examples

  1. Prepare PointPillarNet model and Triton environment, this app will use Triton to do inference, for more details of Triton Inferencing Server, refer to Gst-nvinferserver.

    Follow instructions in deepstream-lidar-inference-app/README to prepare testing resources and Triton CAPI and gRPC environments.

  2. Run the lidar point cloud data inference pipeline in 2 modes.

a. Run lidar data reader, point cloud 3D objects detection inference and 3D data GLES rendering pipeline:

$ deepstream-lidar-inference-app -c configs/config_lidar_source_triton_render.yaml

b. Run lidar data reader, point cloud 3D objects inference and 3D objects file dump pipeline:

$ deepstream-lidar-inference-app -c configs/config_lidar_triton_infer.yaml
  1. This part sets up a lidar point cloud loader dataloader. It then streams ds3d/datamap to the downstream datafilter component lidarfilter.
name: lidarsource
type: ds3d::dataloader
out_caps: ds3d/datamap
custom_lib_path: libnvds_lidarfileread.so
custom_create_function: createLidarFileLoader
  1. It streams ds3d/datamap to the nvds3dfilter Gst-plugin which loads lidarfilter to do Triton inferencing on point cloud. For more details on nvds3dfilter Gst-plugin, See Gst-nvds3dfilter.
name: lidarfilter
type: ds3d::datafilter
in_caps: ds3d/datamap
out_caps: ds3d/datamap
custom_lib_path: libnvds_tritoninferfilter.so
custom_create_function: createLidarInferenceFilter
  • Field of model_inputs is the description of the model input layers. Includes layer name, layer data type and layer dimensions.

    model_inputs:
    - name: points # name of the 1st layer
    datatype: FP32 # data type of the 1st layer
    shape: [1, 204800, 4] # data dimension of the 1st layer
    - name: num_points # name of the 2nd layer
    datatype: INT32 # data type of the 2nd layer
    shape: [1] # data dimension of the 2nd layer
  • Field of model_outputs is the description of the model output layers. Includes layer name, layer data type and layer dimensions.

    model_outputs:
    - name: output_boxes # name of the 1st layer
    datatype: FP32 # data type of the 1st layer
    shape: [1, 393216, 9] # data dimension of the 1st layer
    - name: num_boxes # name of the 2nd layer
    datatype: INT32 # data type of the 2nd layer
    shape: [1] # data dimension of the 2nd layer
  • Field of labels is the label list of the point cloud inferencing model.

    labels: # YAML list for object labels
    - Vehicle
    - Pedestrian
    - Cyclist
  1. Finally the data stream as ds3d/datamap is delivered to the render component.

    a. 3D detection file dump component lidarfiledump.

    name: lidarfiledump
    type: ds3d::datarender
    in_caps: ds3d/datamap
    custom_lib_path: libnvds_lidarfilewrite.so
    custom_create_function: createLidarFileDataRender

    b. GLES lidar data rendering component lidardatarender.

    name: lidardatarender
    type: ds3d::datarender
    in_caps: ds3d/datamap
    custom_lib_path: libnvds_3d_gl_datarender.so
    custom_create_function: createLidarDataRender

Check the /opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-lidar-inference-app/README file for more details.

DeepStream Lidar Inference App Configuration Specifications

deepstream-lidar-inference-app [ds3d::userapp] group settings

deepstream-lidar-inference-app [ds3d::userapp] group settings

The table below demonstrates the group settings for config_lidar_triton_infer.yaml and config_lidar_source_triton_render.yaml as the examples.

point cloud inferencing app user debug supported settings

GroupPropertyMeaningType and RangeExample
LidarFileLoaderdata_config_filelidar data list file pathstringdata_config_file: lidar_data_list.yaml
LidarFileLoaderpoints_numnumber of the points in pointcloud filefixed valuepoints_num: 204800
LidarFileLoaderlidar_datatypedata type of the datasetString:FP32 FP16 INT8 INT32lidar_datatype: FP32
LidarFileLoadermem_typememory type of process data:just support cpu nowString:gpu cpumem_type: cpu
LidarFileLoadermem_pool_sizeSize of the data read poolInteger: >0mem_pool_size: 4
LidarFileLoaderoutput_datamap_keydatamap key in lidarsourcestringoutput_datamap_key: DS3D::LidarXYZI
LidarFileLoaderfile_loopflag for file reading loopbooleanfile_loop: False
LidarInferenceFilterin_streamswhich data type will be processedfixed valuein_streams: [lidar]
LidarInferenceFiltermem_pool_sizeSize of the input tensor poolIntegermem_pool_size: 8
LidarInferenceFiltermodel_inputsmodel ‘s input layersArrayrefer to config_lidar_triton_infer.yaml
LidarInferenceFiltermodel_outputsmodel ‘s output layersArrayrefer to config_lidar_triton_infer.yaml
LidarInferenceFilterinput_tensor_mem_typeinput tensor memory type after preprocessString:GpuCuda CpuCudainput_tensor_mem_type: GpuCuda
LidarInferenceFiltercustom_preprocess_lib_pathpreprocessing library pathStringcustom_preprocess_lib_path: /opt/nvidia/deepstream/deepstream/lib/libnvds_lidar_custom_preprocess_impl.so
LidarInferenceFiltercustom_preprocess_func_namecustomized preprocessing function nameStringcustom_preprocess_func_name: CreateInferServerCustomPreprocess
LidarInferenceFilterlabelslabel list for the detection modelArrayrefer to config_lidar_triton_infer.yaml
LidarInferenceFilterpostprocess_nms_iou_threshNMS IOU thresholdFloatpostprocess_nms_iou_thresh: 0.01
LidarInferenceFilterpostprocess_pre_nms_top_nnumber of TOPs of NMSIntegerpostprocess_nms_top_n: 4096
LidarInferenceFilterconfig_filenvinferserver configuration fileStringconfig_file: triton_mode_CAPI.txt
LidarInferenceFiltergpu_idGPU id for the tensor memory(for native Triton Server Inferencing)Integergpu_id: 0
LidarInferenceFilterfilter_input_datamap_keyinput datamap key from lidarsourceStringfilter_input_datamap_key: DS3D::LidarXYZI
LidarFileDataRenderframes_save_paththe path of the dump fileStringframes_save_path: ../data/
LidarFileDataRenderinput_datamap_keyinput key from the custom_postprocess for inferencing objectsStringinput_datamap_key: DS3D::Lidar3DBboxRawData
LidarDataRendertitlethe title of the renderStringtitle: ds3d-lidar-render
LidarDataRenderstreamsthe stream key(s) for the input to be renderedListstreams: [lidardata]
LidarDataRenderwidthrender area widthIntegerwidth: 1280
LidarDataRenderheightrender area heightIntegerheight: 720
LidarDataRenderblockthe flag of enabling block functionBooleanblock: True
LidarDataRenderview_positionthe view position for lookat vectorListview_position: [0, 0, 80]
LidarDataRenderview_targetthe view target for lookat vectorListview_target: [0, 0, 0]
LidarDataRenderview_upthe up vector of the visualizerListview_up: [1, 0, 0]
LidarDataRendernearthe near z-plane of the visualizer constantsFloatnear: 0.3
LidarDataRenderfarthe far z-plane of the visualizer constantsFloatfar: 100
LidarDataRenderfovdegree for field of viewIntegerfov: 45
LidarDataRenderlidar_colorthe RGB color description of the lidar dataList,lidar_color: [0, 255, 0]
LidarDataRenderlidar_data_keythe lidar data key name in datamapStringlidar_data_key: DS3D::LidarXYZI
LidarDataRenderelement_sizethe lidar data element size (4, XYZI or 3, XYZ)Integerelement_size: 4
LidarDataRenderlidar_bbox_keythe 3D bbox data key name in datamapStringDS3D::Lidar3DBboxRawData
LidarDataRenderenable_labelIndicate flag to enable labels renderingBooleanenable_label: True

DS3D Custom Components Configuration Specifications

See more details in the DS_3D supported custom components specifications section in the DeepStream-3D Custom Apps and Libs Tutorials.

Build application From Source
  1. Go to the folder sources/apps/sample_apps/deepstream-lidar-inference-app.

  2. Run the following commands:

    $ sudo make
    $ sudo make install

Check the source code for more details on how to load dataloader/datarender through Gst-appsrc and Gst-appsink. datafilter is loaded by the nvds3dfilter Gst-plugin.