• <xmp id="om0om">
  • <table id="om0om"><noscript id="om0om"></noscript></table>
  • 高性能計算

    使用 NVIDIA CUDA-Pointpillars 檢測點云中的對象

    點云是坐標系中的點數據集。點包含豐富的信息,包括三維坐標(X、Y、Z)、顏色、分類值、強度值和時間等。點云主要來自于各種NVIDIA Jetson用例中常用的激光雷達,如自主機器、感知模塊和3D建模。

    其中一個關鍵應用是利用遠程和高精度的數據集來實現3D對象的感知、映射和定位算法。

    PointPillars是最常用于點云推理的模型之一。本文將探討為Jetson開發者提供的NVIDIA CUDA加速PointPillars模型。馬上下載CUDA-PointPillars模型

    什么是CUDA-Pointpillars

    本文所介紹的CUDA-Pointpillars可以檢測點云中的對象。其流程如下:

    • 基本預處理:生成柱體。
    • 預處理:生成BEV特征圖(10個通道)。
    • 用于TensorRT的ONNX模型:通過TensorRT實現的ONNX模式。
    • 后處理:通過解析TensorRT引擎輸出生成邊界框。
    Image shows the pipeline of CUDA-Pointpillars, which has four parts and uses a point cloud as input and output-bounding box.Image shows the pipeline of CUDA-Pointpillars, which has four parts and uses a point cloud as input and output-bounding box.
    圖 1 。 CUDA 點柱管道。

    基本預處理

    基本預處理步驟將點云轉換為基本特征圖。基本特征圖包含以下組成部分:

    • 基本特征圖。
    • 柱體坐標:每根柱體的坐標。
    • 參數:柱體數量。
    Image shows how to convert points cloud into base feature maps and what is the struct of base feature maps.Image shows how to convert points cloud into base feature maps and what is the struct of base feature maps.
    圖 2 。將點云轉換為基礎要素地圖

    預處理

    預處理步驟將基本特征圖(4個通道)轉換為 BEV 特征圖(10個通道)。

    Image shows how to convert 4 channels from base feature maps into 0 channels of BEV feature maps.Image shows how to convert 4 channels from base feature maps into 0 channels of BEV feature maps.
    圖 3 。將基本要素地圖轉換為 BEV 要素地圖

    用于TensorRT的ONNX模型

    出于以下原因修改OpenPCDet的原生點柱:

    • 小型操作過多,并且內存帶寬低。
    • NonZero等一些TensorRT不支持的操作。
    • ScatterND等一些性能較低的操作。
    • 使用“dict”作為輸入和輸出,因此無法導出ONNX文件。

    為了從原生OpenPCDet導出ONNX,我們修改了該模型(圖4)。

    Image shows an ONNX model in CUDA-Pointpillars, which was exported from OpenPCDet and simplified by onnx-simplifier.Image shows an ONNX model in CUDA-Pointpillars, which was exported from OpenPCDet and simplified by onnx-simplifier.
    圖 4 。 CUDA Pointpillars 中 ONNX 模型概述。

    您可把整個ONNX文件分為以下幾個部分:

    • 輸入:BEV特征圖、柱體坐標、參數,均在預處理中生成。
    • 輸出:類、框、Dir_class,在后處理步驟中解析后生成一個邊界框。
    • ScatterBEV:將點柱(一維)轉換為二維圖像,可作為TensorRT的插件。
    • 其他:TensorRT支持的其他部分。
    Image shows how to scatter point pillars into 2D image for 2D backbone, which detects objects.Image shows how to scatter point pillars into 2D image for 2D backbone, which detects objects.
    圖 5 。將點支柱數據散射到二維主干的二維圖像中。

    后處理

    在后處理步驟中解析TensorRT引擎的輸出(class、box和dir_class)和輸出邊界框。圖6所示的是示例參數。

    Image shows members of a bounding box and their physical significance.Image shows members of a bounding box and their physical significance.
    圖 6 。邊界框的參數。

    使用 CUDA PointPillars

    若要使用CUDA-PointPillars,需要提供點云的ONNX模式文件和數據緩存:

     std::vector<Bndbox> nms_pred; PointPillar pointpillar(ONNXModel_File, cuda_stream); pointpillar.doinfer(points_data, points_count, nms_pred);

    將OpenPCDet訓練的原生模型轉換為CUDA-Pointpillars的ONNX文件

    我們在項目中提供了一個Python腳本,可以將OpenPCDet訓練的原生模型轉換成CUDA-Pointpillars的ONNX文件。可在CUDA-Pointpillars的/tool?目錄下找到exporter.py?腳本。

    可在當前目錄下運行以下命令獲得pointpillar.onnx文件:

    $ python exporter.py --ckpt ./*.pth

    性能

    下表顯示了測試環境和性能。在測試之前提升CPU和GPU的性能。

    Jetson Xavier NVIDIA AGX 8GB
    Release NVIDIA JetPack 4.5
    CUDA 10.2
    TensorRT 7.1.3
    Infer Time 33 ms
    ?
    表 1 。測試平臺與性能

    開始使用 CUDA PointPillars

    本文介紹了什么是CUDA-PointPillars以及如何使用它來檢測點云中的對象。

    由于原生OpenPCDet無法導出ONNX,而且對于TensorRT來說,性能較低的小型操作數量過多,因此我們開發了CUDA-PointPillars。該應用可以將OpenPCDet訓練的原生模型導出為特殊的ONNX模型,并通過TensorRT推斷ONNX模型。

    立即下載 CUDA-PointPillars。

    ?
    +1

    標簽

    人人超碰97caoporen国产