TensorRT examples (Jetson, Python/C++)(object detection)

Overview
You might also like...
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection
Hybrid CenterNet - Hybrid-supervised object detection / Weakly semi-supervised object detection

Hybrid-Supervised Object Detection System Object detection system trained by hybrid-supervision/weakly semi-supervision (HSOD/WSSOD): This project is

tensorrt int8 量化yolov5 4.0 onnx模型

onnx模型转换为 int8 tensorrt引擎

3D ResNet Video Classification accelerated by TensorRT
3D ResNet Video Classification accelerated by TensorRT

Activity Recognition TensorRT Perform video classification using 3D ResNets trained on Kinetics-400 dataset and accelerated with TensorRT P.S Click on

PyTorch ,ONNX and TensorRT implementation of YOLOv4
PyTorch ,ONNX and TensorRT implementation of YOLOv4

PyTorch ,ONNX and TensorRT implementation of YOLOv4

EfficientNetv2 TensorRT int8

EfficientNetv2_TensorRT_int8 EfficientNetv2模型实现来自https://github.com/d-li14/efficientnetv2.pytorch 环境配置 ubuntu:18.04 cuda:11.0 cudnn:8.0 tensorrt:7

Export CenterPoint PonintPillars ONNX Model For TensorRT
Export CenterPoint PonintPillars ONNX Model For TensorRT

CenterPoint-PonintPillars Pytroch model convert to ONNX and TensorRT Welcome to CenterPoint! This project is fork from tianweiy/CenterPoint. I impleme

A high-performance anchor-free YOLO. Exceeding yolov3~v5 with ONNX, TensorRT, NCNN, and Openvino supported.
A high-performance anchor-free YOLO. Exceeding yolov3~v5 with ONNX, TensorRT, NCNN, and Openvino supported.

YOLOX is an anchor-free version of YOLO, with a simpler design but better performance! It aims to bridge the gap between research and industrial communities. For more details, please refer to our report on Arxiv.

YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with ONNX, TensorRT, ncnn, and OpenVINO supported.
YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with ONNX, TensorRT, ncnn, and OpenVINO supported.

Introduction YOLOX is an anchor-free version of YOLO, with a simpler design but better performance! It aims to bridge the gap between research and ind

This package proposes simplified exporting pytorch models to ONNX and TensorRT, and also gives some base interface for model inference.

PyTorch Infer Utils This package proposes simplified exporting pytorch models to ONNX and TensorRT, and also gives some base interface for model infer

Comments
  • Cmake building for wrong TRT version

    Cmake building for wrong TRT version

    Hi,

    I'm trying to reproduce the exact same steps from your Object Detection tutorial on Jetson Nano.

    I've started from a fresh Jetpack 4.5.1 installation and executed the commands:

    sudo apt remove cmake sudo snap install cmake --classic sudo reboot

    cd ~ git clone https://github.com/NobuoTsukamoto/tensorrt-examples cd ./tensorrt-examples git submodule update --init --recursive

    export TRT_LIBPATH=pwd/TensorRT export PATH=${PATH}:/usr/local/cuda/bin cd $TRT_LIBPATH mkdir -p build && cd build

    Until now, everything works fine. But when I execute the cmake command:

    cmake .. -DTRT_LIB_DIR=$TRT_LIBPATH -DTRT_OUT_DIR=pwd/out -DTRT_PLATFORM_ID=aarch64 -DCUDA_VERSION=10.2 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=/usr/bin/gcc

    It tells me TensorRT is being built for version 8.2.0:

    Building for TensorRT version: 8.2.0, library version: 8
    

    Just to double check I ran a "dpkg -l" command and saw that my TensorRT version is actually 7.1.3. Even so, the cmake compiles with no errors and the build files get written succesfully. So I tried running make:

    make -j3

    And got the following error:

    [  2%] Built target third_party.protobuf
    [  3%] Built target third_party.protobuf_aarch64
    [  4%] Built target gen_onnx_proto
    [  4%] Built target caffe_proto
    [  5%] Running gen_proto.py on onnx/onnx-data.in.proto
    Consolidate compiler generated dependencies of target nvinfer_plugin
    Consolidate compiler generated dependencies of target nvinfer_plugin_static
    [  5%] Building CXX object plugin/CMakeFiles/nvinfer_plugin.dir/tfliteNMSPlugin/tfliteNMSPlugin.cpp.o
    [  6%] Building CXX object plugin/CMakeFiles/nvinfer_plugin_static.dir/tfliteNMSPlugin/tfliteNMSPlugin.cpp.o
    Processing /home/joao/tensorrt-examples/TensorRT/parsers/onnx/third_party/onnx/onnx/onnx-data.in.proto
    Writing /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-data_onnx2trt_onnx.proto
    Writing /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-data_onnx2trt_onnx.proto3
    Writing /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-data.pb.h
    generating /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx_data_pb.py
    [  6%] Running gen_proto.py on onnx/onnx-operators.in.proto
    Processing /home/joao/tensorrt-examples/TensorRT/parsers/onnx/third_party/onnx/onnx/onnx-operators.in.proto
    Writing /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-operators_onnx2trt_onnx-ml.proto
    Writing /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-operators_onnx2trt_onnx-ml.proto3
    Writing /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-operators-ml.pb.h
    generating /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx_operators_pb.py
    [  6%] Running C++ protocol buffer compiler on /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-data_onnx2trt_onnx.proto
    [  6%] Running C++ protocol buffer compiler on /home/joao/tensorrt-examples/TensorRT/build/parsers/onnx/third_party/onnx/onnx/onnx-operators_onnx2trt_onnx-ml.proto
    [  6%] Building CXX object parsers/onnx/third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx_onnx2trt_onnx-ml.pb.cc.o
    plugin/CMakeFiles/nvinfer_plugin.dir/build.make:439: recipe for target 'plugin/CMakeFiles/nvinfer_plugin.dir/tfliteNMSPlugin/tfliteNMSPlugin.cpp.o' failed
    CMakeFiles/Makefile2:1361: recipe for target 'plugin/CMakeFiles/nvinfer_plugin.dir/all' failed
    [  7%] Building CXX object plugin/CMakeFiles/nvinfer_plugin_static.dir/bertQKVToContextPlugin/fused_multihead_attention/src/fused_multihead_attention_fp16_64_64_kernel.sm75.cpp.o
    plugin/CMakeFiles/nvinfer_plugin_static.dir/build.make:439: recipe for target 'plugin/CMakeFiles/nvinfer_plugin_static.dir/tfliteNMSPlugin/tfliteNMSPlugin.cpp.o' failed
    [  7%] Building CXX object parsers/onnx/third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-operators_onnx2trt_onnx-ml.pb.cc.o
    CMakeFiles/Makefile2:1387: recipe for target 'plugin/CMakeFiles/nvinfer_plugin_static.dir/all' failed
    [  7%] Building CXX object parsers/onnx/third_party/onnx/CMakeFiles/onnx_proto.dir/onnx/onnx-data_onnx2trt_onnx.pb.cc.o
    [  7%] Linking CXX static library libonnx_proto.a
    [  8%] Built target onnx_proto
    Makefile:155: recipe for target 'all' failed
    

    Would you have any other specific instructions in order to reproduce your object detection examples? I need to run tensorrt optimized object detection inference from tensorflow models and this has been the best guide I have found so far.

    Thank you in advance!

    opened by jgocm 9
  • ssd_mobilenet_v1_fpn_coco ONNX GraphSurgeon to TensorRT conversion assertion errors

    ssd_mobilenet_v1_fpn_coco ONNX GraphSurgeon to TensorRT conversion assertion errors

    I have built the project on Jetpack 4.5.1 following the instructions from: https://github.com/NobuoTsukamoto/tensorrt-examples/issues/3#issuecomment-1062732055tensor

    Then, created ONNX GraphSurgeon for ssd_mobilenet_v1_fpn_coco using the Add_TFLiteNMS_Plugin notebook, by replacing "ssdlite_mobilenet_v2_coco_2018_05_09" model with "ssd_mobilenet_v1_fpn_shared_box_predictor_640x640_coco14_sync_2018_07_03" and input shapes from "input_shapes=1,300,300,3" to "input_shapes=1,640,640,3". Here is my TFLiteNMS_Plugin notebook.

    When trying to convert the model from onnx to trt on Jetson Nano with convert_onnxgs2trt.py, got the following error:

    Beginning ONNX file parsing
    [TensorRT] WARNING: onnx2trt_utils.cpp:220: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
    [TensorRT] INTERNAL ERROR: Assertion failed: inputs[0].nbDims == 3
    /home/joao/tensorrt-examples/TensorRT/plugin/tfliteNMSPlugin/tfliteNMSPlugin.cpp:74
    Aborting...
    

    Looking deeper into tfliteNMSPlugin.cpp, this assertion comes from TFLiteNMSPlugin::getOutputDimensions, at line 74. Just to check, I tried printing the number of dimensions of the inputs from the input vector:

    Dims TFLiteNMSPlugin::getOutputDimensions(int index, const Dims* inputs, int nbInputDims) noexcept
    {
        printf("inputs[0] dimensions: %i\n", inputs[0].nbDims);
        printf("inputs[1] dimensions: %i\n", inputs[1].nbDims);
        printf("inputs[2] dimensions: %i\n", inputs[2].nbDims);
        ASSERT(nbInputDims == 3);
        ASSERT(index >= 0 && index < this->getNbOutputs());
        ASSERT(inputs[0].nbDims == 3);
        ASSERT(inputs[1].nbDims == 2 || (inputs[1].nbDims == 3 && inputs[1].d[2] == 1));
        ASSERT(inputs[2].nbDims == 2);
        // boxesSize: number of box coordinates for one sample
        boxesSize = inputs[0].d[0] * inputs[0].d[1] * inputs[0].d[2];
        // scoresSize: number of scores for one sample
        scoresSize = inputs[1].d[0] * inputs[1].d[1];
        // anchorSize: number of anchors for one sample
        anchorsSize = inputs[2].d[0] * inputs[2].d[2];
    
        // num_detections
        if (index == 0)
        {
            Dims dim0{};
            dim0.nbDims = 0;
            return dim0;
        }
        // nmsed_boxes
        if (index == 1)
        {
            return DimsHW(param.max_detections, 4);
        }
        // nmsed_scores or nmsed_classes
        Dims dim1{};
        dim1.nbDims = 1;
        dim1.d[0] = param.max_detections;
        return dim1;
    }
    

    The result was:

    inputs[0] dimensions: 2
    inputs[1] dimensions: 2
    inputs[2] dimensions: 2
    [TensorRT] INTERNAL ERROR: Assertion failed: inputs[0].nbDims == 3
    

    So my questions are:

    1. Have you been able to use the NMS Plugin for any other networks from Tensorflow 1 Model Zoo than SSDLite MobileNetv2? If yes, how did you do it?
    2. If not, do you know what might be causing this input dimensions errors?

    Here is my network ONNX GraphSurgeon file.

    EDIT: Sharing also an image of the network generated from Netron. ssd_mobilenet_v1_fpn_640x640_gs

    opened by jgocm 4
Owner
Nobuo Tsukamoto
Nobuo Tsukamoto
A python implementation of Yolov5 to detect fire or smoke in the wild in Jetson Xavier nx and Jetson nano

yolov5-fire-smoke-detect-python A python implementation of Yolov5 to detect fire or smoke in the wild in Jetson Xavier nx and Jetson nano You can see

null 20 Dec 15, 2022
ColossalAI-Examples - Examples of training models with hybrid parallelism using ColossalAI

ColossalAI-Examples This repository contains examples of training models with Co

HPC-AI Tech 185 Jan 9, 2023
Easy to use Python camera interface for NVIDIA Jetson

JetCam JetCam is an easy to use Python camera interface for NVIDIA Jetson. Works with various USB and CSI cameras using Jetson's Accelerated GStreamer

NVIDIA AI IOT 358 Jan 2, 2023
🦕 NanoSaur is a little tracked robot ROS2 enabled, made for an NVIDIA Jetson Nano

?? nanosaur NanoSaur is a little tracked robot ROS2 enabled, made for an NVIDIA Jetson Nano Website: nanosaur.ai Do you need an help? Discord For tech

NanoSaur 162 Dec 9, 2022
Jetson Nano-based smart camera system that measures crowd face mask usage in real-time.

MaskCam MaskCam is a prototype reference design for a Jetson Nano-based smart camera system that measures crowd face mask usage in real-time, with all

BDTI 212 Dec 29, 2022
An open source Jetson Nano baseboard and tools to design your own.

My Jetson Nano Baseboard This basic baseboard gives the user the foundation and the flexibility to design their own baseboard for the Jetson Nano. It

NVIDIA AI IOT 57 Dec 29, 2022
AI pipelines for Nvidia Jetson Platform

Jetson Multicamera Pipelines Easy-to-use realtime CV/AI pipelines for Nvidia Jetson Platform. This project: Builds a typical multi-camera pipeline, i.

NVIDIA AI IOT 96 Dec 23, 2022
Energy consumption estimation utilities for Jetson-based platforms

This repository contains a utility for measuring energy consumption when running various programs in NVIDIA Jetson-based platforms. Currently TX-2, NX, and AGX are supported.

OpenDR 10 Jun 17, 2022
Predict bus arrival time using VertexAI and Nvidia's Jetson Nano

bus_prediction predict bus arrival time using VertexAI and Nvidia's Jetson Nano imagenet the command for imagenet.py look like this python3 /path/to/i

null 10 Dec 22, 2022
Yolo object detection - Yolo object detection with python

How to run download required files make build_image make download Docker versio

null 3 Jan 26, 2022