NVIDIA / Deep-Learning-Accelerator-SW

NVIDIA DLA-SW, the recipes and tools for running deep learning workloads on NVIDIA DLA cores for inference applications.
Other
181 stars 15 forks source link

How to get bbox from tensorrt #18

Closed jongsik-moon closed 1 year ago

jongsik-moon commented 1 year ago

Hi guys, I followed https://github.com/NVIDIA/Deep-Learning-Accelerator-SW/blob/main/scripts/prepare_models/README.md and successfully exported a tensorrt engine of retinanet resnext .

The question is, how can I get bbox using the tensorrt engine? In the retinanet_resnext50.py file, nms is removed and the output format of the engine is as follows.

`

---- 1 Engine Input(s) ----
{input [dtype=int8, shape=(1, 3, 800, 800)]}

---- 10 Engine Output(s) ----
{onnx::Shape_1554 [dtype=int8, shape=(1, 2376, 25, 25)],
 onnx::Shape_1770 [dtype=int8, shape=(1, 36, 25, 25)],
 onnx::Shape_1597 [dtype=int8, shape=(1, 2376, 13, 13)],
 onnx::Shape_1813 [dtype=int8, shape=(1, 36, 13, 13)],
 onnx::Shape_1511 [dtype=int8, shape=(1, 2376, 50, 50)],
 onnx::Shape_1727 [dtype=int8, shape=(1, 36, 50, 50)],
 onnx::Shape_1640 [dtype=int8, shape=(1, 2376, 7, 7)],
 onnx::Shape_1856 [dtype=int8, shape=(1, 36, 7, 7)],
 onnx::Shape_1468 [dtype=int8, shape=(1, 2376, 100, 100)],
 onnx::Shape_1684 [dtype=int8, shape=(1, 36, 100, 100)]}

---- Memory ----
Device Memory: 0 bytes

---- 1 Profile(s) (11 Tensor(s) Each) ----
- Profile: 0
    Tensor: input                     (Input), Index: 0 | Shapes: min=(1, 3, 800, 800), opt=(1, 3, 800, 800), max=(1, 3, 800, 800)
    Tensor: onnx::Shape_1554         (Output), Index: 1 | Shape: (1, 2376, 25, 25)
    Tensor: onnx::Shape_1770         (Output), Index: 2 | Shape: (1, 36, 25, 25)
    Tensor: onnx::Shape_1597         (Output), Index: 3 | Shape: (1, 2376, 13, 13)
    Tensor: onnx::Shape_1813         (Output), Index: 4 | Shape: (1, 36, 13, 13)
    Tensor: onnx::Shape_1511         (Output), Index: 5 | Shape: (1, 2376, 50, 50)
    Tensor: onnx::Shape_1727         (Output), Index: 6 | Shape: (1, 36, 50, 50)
    Tensor: onnx::Shape_1640         (Output), Index: 7 | Shape: (1, 2376, 7, 7)
    Tensor: onnx::Shape_1856         (Output), Index: 8 | Shape: (1, 36, 7, 7)
    Tensor: onnx::Shape_1468         (Output), Index: 9 | Shape: (1, 2376, 100, 100)
    Tensor: onnx::Shape_1684         (Output), Index: 10 | Shape: (1, 36, 100, 100)

---- 1 Layer(s) ----

`

Can you give an extra inference code using the output to make bbox information?

nvoliver commented 1 year ago

Hi @jongsik-moon, this question is best suited for https://github.com/NVIDIA/TensorRT which includes many samples showcasing how to make use of TensorRT inference outputs in your application.

For this ResNeXt model in particular (which was used in NVIDIA's MLPerf-Inference 3.0 submission), you can look at https://github.com/mlcommons/inference_results_v3.0/tree/d9f23eb124be29a02833f55f6d518e78e8f6433d/closed/NVIDIA/code/retinanet/tensorrt.