TensorRT backend for ONNX on jetson nano

Hi, sh2222

Sorry for the missing.

It looks like the sample allocate 1G workspace but it is not available on the Jetson Nano.
Please update workspace size into 256Mb. We have verified it can work correctly on the Nano.

diff --git a/onnx_to_tensorrt.py b/onnx_to_tensorrt.py
index 354edfe..d703450 100644
--- a/onnx_to_tensorrt.py
+++ b/onnx_to_tensorrt.py
@@ -98,7 +98,7 @@ def get_engine(onnx_file_path, engine_file_path=""):
     def build_engine():
         """Takes an ONNX file and creates a TensorRT engine to run inference with"""
         with trt.Builder(TRT_LOGGER) as builder, builder.create_network() as network, trt.OnnxParser(network, TRT_LOGGER) as parser:
-            builder.max_workspace_size = 1 << 30 # 1GB
+            builder.max_workspace_size = 1 << 28 # 256MB
             builder.max_batch_size = 1
             # Parse model file
             if not os.path.exists(onnx_file_path):

Thanks.

1 Like

Thanks AastaLLL - that’s useful to know.
And thanks for the info about swappiness mdegans - much appreciated.

Hi, I have the same problems, but do not find a way zu remove onnx completely and to install onnx == 1.4.1.

adves@adves-jetson-nano:~$ python2 -m pip freeze | grep onnx
onnx==1.5.0
adves@adves-jetson-nano:~$ pip3 uninstall onnx
WARNING: Skipping onnx as it is not installed.
adves@adves-jetson-nano:~$ pip uninstall onnx
WARNING: Skipping onnx as it is not installed.

How can I remove onnx complete?

@ADV-LUT try “pip2 uninstall onnx”. It’s possible that pip is symlinked to pip3 on your system. You should be able to verify with “pip --version”.

Hi,

You can try this:

pip uninstall onnx

Thanks.

Hi,

unfortunately, both versions do not work:

pip2 uninstall onnx
pip uninstall onnx

I have completely reset the Jetson Nano and installed it in the correct version at the beginning, now it works.

sudo apt-get install protobuf-compiler libprotoc-dev

before

pip install onnx=1.4.1

as per When installing in a non-Anaconda environment, make sure to install the Protobuf compiler before running the pip installation of onnx. For example, on Ubuntu https://github.com/onnx/onnx

2 Likes

I was having same problem on my jetson Xavier: unable to install onnx==1.4.1 for python3, I solved the problem by running these commands:

sudo apt-get install protobuf-compiler libprotoc-dev

sudo pip3 install onnx==1.4.1

thanks

Hey, trying this solution on a Jetson Nano 2GB does NOT work. Any solutions? Please advise!

Hi bhaktatejas922,

Please help to open a new topic for your issue. Thanks

I Searched everywhere ,finally, i found your answer, thanks a lot