Unable to setup nvOCDR on Jetson Orin NX

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 6.2
• JetPack Version (valid for Jetson only) 5.1.2
• TensorRT Version 8.5.2
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs) Question

Hello,
I am trying to execute this sample OCR application on the Jetson Orin NX and deploy it via Triton. Initially I tried using the tao-5.2 branch of the repository which has the ViT models but ran into an issue at this step:

bash build_engine.sh 736 1280 4 0 after the creation of the Triton server. Please find the error below

Cuda failure: CUDA driver version is insufficient for CUDA runtime version
build_engine.sh: line 17:   128 Aborted                 
(core dumped) /usr/src/tensorrt/bin/trtexec --device=${DEVICE} --onnx=/opt/nvocdr/onnx_model/ocdnet_vit.onnx --minShapes=input:1x3x${OCD_H}x${OCD_W} --optShapes=input:${OCD_MAX_BS}x3x${OCD_H}x${OCD_W} --maxShapes=input:${OCD_MAX_BS}x3x${OCD_H}x${OCD_W} --fp16 --saveEngine=/opt/nvocdr/engines/ocdnet_vit.fp16.engine

I have tried executing it without the vit-models too (since ViT models need trtexec 8.6+)by following the README on the tao-5.0 branch however the docker build for the Triton Server failed with the following error


134.5 cp: cannot create regular file '/usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so.8.5.3': No such file or directory
------
Triton_Server.Dockerfile:20
--------------------
  19 |     # step3: install deformable-conv trt plugin
  20 | >>> RUN wget https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.0/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8_1.0-1_amd64.deb && \
  21 | >>>     dpkg-deb -xv nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8_1.0-1_amd64.deb debs && \
  22 | >>>     cd debs/var/nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8 && \
  23 | >>>     dpkg-deb  -xv libnvinfer-plugin8_8.6.0.12-1+cuda11.8_amd64.deb deb_file && \
  24 | >>>     cp deb_file/usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so.8.6.0  /usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so.8.5.3
  25 |         
--------------------
ERROR: failed to solve: process "/bin/sh -c wget https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.0/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8_1.0-1_amd64.deb &&     dpkg-deb -xv nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8_1.0-1_amd64.deb debs &&     cd debs/var/nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8 &&     dpkg-deb  -xv libnvinfer-plugin8_8.6.0.12-1+cuda11.8_amd64.deb deb_file &&     cp deb_file/usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so.8.6.0  /usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so.8.5.3" did not complete successfully: exit code: 1

Kindly advise the right steps to setup these models on the Triton server. I am currently using PaddleOCR on the Jetson (without GPU) and would like to test the nvOCDR models for faster inferencing.

please check if all libs version meets the requirements according to this table. if yes, could you execute that trtexec command-list to get more logs?

please check if libnvinfer_plugin.so.8.6.0 exists. if yes, will copying to other paths succeed?

Sorry for the late reply, Is this still an DeepStream issue to support? Thanks!
as the doc shown, there is a tip “TensorRT 8.5 or above (To use ViT-based model, TensorRT 8.6 above is required.)”. please install jp6.0 for iT-based model.

Hi, please leave this topic open for a few more days. Will get back to it soon.

OK, thanks for the update!

Hi @fanzh
I am looking into this topic again.

please check if libnvinfer_plugin.so.8.6.0 exists

Yes, libnvinfer_plugin.so.8.6.0 does exist, however the path to which this file is being copied does not exist. Jetson does not contain

/usr/lib/x86_64-linux-gnu

however it has

/usr/lib/aarch64-linux-gnu

Is the Dockerfile of Triton Server meant to be deployed on a Jetson? My use case is to use the OCR/OCD onnx models for character recognition, deploy it on my custom triton server with other models on the Jetson and perform inferencing.

I have tried following these links -

  1. Deploying nvOCDR to DeepStream - NVIDIA Docs
  2. NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton at main · NVIDIA-AI-IOT/NVIDIA-Optical-Character-Detection-and-Recognition-Solution · GitHub
    but am unable to set it up for OCD/OCR (facing the errors as mentioned in the original post). Are there any other links for this purpose?

from the code " cp deb_file/usr/lib/x86_64-linux-gnu", it is used to dgpu, you need to modify the code for Jetson.

after modifying the code for Jetson, please share the new error.

I made this change in the Triton_Server.Dockerfile
cp deb_file/usr/lib/x86_64-linux-gnu/libnvinfer_plugin.so.8.6.0 /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so.8.5.3 Attaching the new Dockerfile I am using
Triton_Server.Dockerfile.txt (1.7 KB)

I don’t think this is the correct way to do it since it is just copying the x86 nvinfer file to aarch64 directory. However, the file might still be incompatible due to architectural differences. Can you please share the correct Triton_Server.Dockerfile to be used for setting it up on the Jetson?

Please find the error I received after making the change as mentioned above -

nvidia@ubuntu:~/ocr_nvidia/NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton$ sudo bash setup_triton_server.sh onnx_models/ocdnet.onnx onnx_models/ocrnet.onnx onnx_models/character_list.txt
[sudo] password for nvidia: 
Set input size to HxW: onnx_models/ocdnet.onnxxonnx_models/ocrnet.onnx and max batch size: onnx_models/character_list.txt for ocd tensorRT engine
[+] Building 1225.4s (16/17)                                                                                                                                                                                                                                                                                   docker:default
 => [internal] load build definition from Triton_Server.Dockerfile                                                                                                                                                                                                                                                       0.0s
 => => transferring dockerfile: 1.82kB                                                                                                                                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                        0.0s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                          0.0s
 => [internal] load metadata for nvcr.io/nvidia/tritonserver:23.02-py3                                                                                                                                                                                                                                                   1.0s
 => [ 1/13] FROM nvcr.io/nvidia/tritonserver:23.02-py3@sha256:2ab9e1cbd88a3e7fc29c6e393ac50e78604efc4ca67e8da9fa1fd94afe3fda7b                                                                                                                                                                                           0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                        3.7s
 => => transferring context: 246.25MB                                                                                                                                                                                                                                                                                    3.6s
 => CACHED [ 2/13] RUN mkdir -p /opt/nvocdr && cd /opt/nvocdr                                                                                                                                                                                                                                                            0.0s
 => CACHED [ 3/13] RUN mkdir -p /opt/nvocdr/onnx_model                                                                                                                                                                                                                                                                   0.0s
 => CACHED [ 4/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton/models/ocdnet.onnx /opt/nvocdr/onnx_model/ocdnet.onnx                                                                                                                                                                         0.0s
 => CACHED [ 5/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton/models/ocrnet.onnx /opt/nvocdr/onnx_model/ocrnet.onnx                                                                                                                                                                         0.0s
 => CACHED [ 6/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton/models/character_list /opt/nvocdr/onnx_model/character_list                                                                                                                                                                   0.0s
 => CACHED [ 7/13] RUN ls -l /opt/nvocdr/onnx_model/                                                                                                                                                                                                                                                                     0.0s
 => [ 8/13] RUN wget https://developer.nvidia.com/downloads/compute/machine-learning/tensorrt/secure/8.6.0/local_repos/nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8_1.0-1_amd64.deb &&     dpkg-deb -xv nv-tensorrt-local-repo-ubuntu2004-8.6.0-cuda-11.8_1.0-1_amd64.deb debs &&     cd debs/var/nv-tensorrt-lo  288.8s
 => [ 9/13] RUN apt-get update && apt-get install libgl1-mesa-glx --yes && apt-get install libopencv-dev --yes                                                                                                                                                                                                         519.9s 
 => [10/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution /opt/nvocdr/ocdr                                                                                                                                                                                                                           45.1s 
 => [11/13] RUN cd /opt/nvocdr/ocdr/triton &&     python3 -m pip install --upgrade pip &&     python3 -m pip install nvidia-pyindex &&     python3 -m pip install -r requirements-pip.txt                                                                                                                              318.0s 
 => ERROR [12/13] RUN cd /opt/nvocdr/ocdr/triton && make -j8                                                                                                                                                                                                                                                            46.7s 
------                                                                                                                                                                                                                                                                                                                        
 > [12/13] RUN cd /opt/nvocdr/ocdr/triton && make -j8:                                                                                                                                                                                                                                                                        
2.608 if [ ! -d ./chobj ]; then mkdir -p ./chobj; fi                                                                                                                                                                                                                                                                          
2.609 if [ ! -d ./chobj ]; then mkdir -p ./chobj; fi                                                                                                                                                                                                                                                                          
2.609 if [ ! -d ./chobj ]; then mkdir -p ./chobj; fi                                                                                                                                                                                                                                                                          
2.612 if [ ! -d ./chobj ]; then mkdir -p ./chobj; fi                                                                                                                                                                                                                                                                          
2.613 if [ ! -d ./chobj ]; then mkdir -p ./chobj; fi
2.619 if [ ! -d ./chobj ]; then mkdir -p ./chobj; fi
2.624 if [ ! -d ./chobj ]; then mkdir -p ./chobj; fi
2.860 g++ -MM -MF chobj/OCDNetEngine.d -MP -MT chobj/OCDNetEngine.o -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/ ../src/OCDNetEngine.cpp
2.861 g++ -MM -MF chobj/MemManager.d -MP -MT chobj/MemManager.o -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/ ../src/MemManager.cpp
2.866 g++ -MM -MF chobj/TRTEngine.d -MP -MT chobj/TRTEngine.o -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/ ../src/TRTEngine.cpp
2.872 g++ -MM -MF chobj/nvOCDR.d -MP -MT chobj/nvOCDR.o -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/ ../src/nvOCDR.cpp
2.878 g++ -MM -MF chobj/RectEngine.d -MP -MT chobj/RectEngine.o -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/ ../src/RectEngine.cpp
2.880 g++ -MM -MF chobj/OCRNetEngine.d -MP -MT chobj/OCRNetEngine.o -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/ ../src/OCRNetEngine.cpp
2.881 g++ -MM -MF chobj/kernel.d -MP -MT chobj/kernel.o -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/ ../src/kernel.cu
2.887 g++: warning: ../src/kernel.cu: linker input file unused because linking not done
2.900 Compiling: ../src/kernel.cu
2.900 /usr/local/cuda/bin/nvcc -m64 -ccbin g++ --compiler-options '-fPIC' -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -c -o chobj/kernel.o ../src/kernel.cu
3.366 Compiling: ../src/MemManager.cpp
3.368 g++ -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -fPIC -c -o chobj/MemManager.o ../src/MemManager.cpp
4.423 Compiling: ../src/TRTEngine.cpp
4.424 g++ -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -fPIC -c -o chobj/TRTEngine.o ../src/TRTEngine.cpp
5.494 Compiling: ../src/OCRNetEngine.cpp
5.495 g++ -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -fPIC -c -o chobj/OCRNetEngine.o ../src/OCRNetEngine.cpp
6.895 Compiling: ../src/RectEngine.cpp
6.895 g++ -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -fPIC -c -o chobj/RectEngine.o ../src/RectEngine.cpp
7.410 Compiling: ../src/nvOCDR.cpp
7.411 g++ -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -fPIC -c -o chobj/nvOCDR.o ../src/nvOCDR.cpp
7.453 Compiling: ../src/OCDNetEngine.cpp
7.455 g++ -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -fPIC -c -o chobj/OCDNetEngine.o ../src/OCDNetEngine.cpp
14.49 ../src/nvOCDR.cpp: In member function 'void nvocdr::nvOCDR::inferPatch(void*, void*, const Dims&, const Dims&, float, std::vector<std::vector<std::pair<nvocdr::Polygon, std::pair<std::__cxx11::basic_string<char>, float> > > >&)':
14.49 ../src/nvOCDR.cpp:451:105: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
14.49   451 |             patchMaskMergeCUDA(oriImgBitMapDev.data(), mBuffMgr.mDeviceBuffer[ocdThresholdBufIdx].data()+(i*patch_w*patch_h), oriImgMaskDev.data(), mBuffMgr.mDeviceBuffer[ocdRawOutBufIdx].data()+(i*patch_w*patch_h*sizeof(float)), ocdOutputPatchshape, oriBinaryshape, overlapRate, col_idx, row_idx, num_col_cut, num_row_cut,mStream);
14.49       |                                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
14.49 ../src/nvOCDR.cpp:451:195: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
14.49   451 |             patchMaskMergeCUDA(oriImgBitMapDev.data(), mBuffMgr.mDeviceBuffer[ocdThresholdBufIdx].data()+(i*patch_w*patch_h), oriImgMaskDev.data(), mBuffMgr.mDeviceBuffer[ocdRawOutBufIdx].data()+(i*patch_w*patch_h*sizeof(float)), ocdOutputPatchshape, oriBinaryshape, overlapRate, col_idx, row_idx, num_col_cut, num_row_cut,mStream);
14.49       |                                                                                                                                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22.89 Linking: nvocdr.cpython-38-x86_64-linux-gnu.so
22.89 g++ -O3 -Wall -shared -std=c++11 -I../include -I/usr/include/x86_64-linux-gnu/ -I../src -I/usr/local/cuda/include -I/usr/include/opencv4/   -fPIC  -I/usr/include/python3.8 -I/usr/local/lib/python3.8/dist-packages/pybind11/include pybind.cpp -o nvocdr.cpython-38-x86_64-linux-gnu.so chobj/nvOCDR.o chobj/TRTEngine.o chobj/MemManager.o chobj/OCDNetEngine.o chobj/RectEngine.o chobj/OCRNetEngine.o chobj/kernel.o -L/usr/lib/x86_64-linux-gnu/ -L/usr/local/cuda/lib64 -L/usr/lib/x86_64-linux-gnu/ -L. -lnvinfer -lcudart -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lcublas -lnvinfer_plugin  
29.32 In file included from ../src/nvOCDR.h:10,
29.32                  from pybind.h:6,
29.32                  from pybind.cpp:2:
29.32 ../src/MemManager.h: In instantiation of 'nvocdr::GenericBuffer<AllocFunc, FreeFunc>::GenericBuffer(size_t, size_t) [with AllocFunc = nvocdr::DeviceAllocator; FreeFunc = nvocdr::DeviceFree; size_t = long unsigned int]':
29.32 pybind.cpp:54:60:   required from here
29.32 ../src/MemManager.h:141:12: warning: 'nvocdr::GenericBuffer<nvocdr::DeviceAllocator, nvocdr::DeviceFree>::mItemSize' will be initialized after [-Wreorder]
29.32   141 |     size_t mItemSize;
29.32       |            ^~~~~~~~~
29.32 ../src/MemManager.h:140:22: warning:   'size_t nvocdr::GenericBuffer<nvocdr::DeviceAllocator, nvocdr::DeviceFree>::mCapacity' [-Wreorder]
29.32   140 |     size_t mSize{0}, mCapacity{0};
29.32       |                      ^~~~~~~~~
29.32 ../src/MemManager.h:45:5: warning:   when initialized here [-Wreorder]
29.32    45 |     GenericBuffer(size_t size, size_t item_size)
29.32       |     ^~~~~~~~~~~~~
46.24 /usr/bin/ld: skipping incompatible /usr/lib/gcc/aarch64-linux-gnu/9/../../../aarch64-linux-gnu/libnvinfer_plugin.so when searching for -lnvinfer_plugin
46.24 /usr/bin/ld: skipping incompatible /lib/aarch64-linux-gnu/libnvinfer_plugin.so when searching for -lnvinfer_plugin
46.24 /usr/bin/ld: skipping incompatible /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so when searching for -lnvinfer_plugin
46.24 /usr/bin/ld: skipping incompatible /lib/aarch64-linux-gnu/libnvinfer_plugin.so when searching for -lnvinfer_plugin
46.24 /usr/bin/ld: skipping incompatible /usr/lib/aarch64-linux-gnu/libnvinfer_plugin.so when searching for -lnvinfer_plugin
46.24 /usr/bin/ld: cannot find -lnvinfer_plugin
46.42 collect2: error: ld returned 1 exit status
46.42 make: *** [Makefile:88: nvocdr.cpython-38-x86_64-linux-gnu.so] Error 1
------
Triton_Server.Dockerfile:41
--------------------
  39 |     
  40 |     # step7: build nvocdr lib    
  41 | >>> RUN cd /opt/nvocdr/ocdr/triton && make -j8
  42 |     
  43 |     ENV PYTHONPATH="/opt/nvocdr/ocdr/triton:${PYTHONPATH}"
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /opt/nvocdr/ocdr/triton && make -j8" did not complete successfully: exit code: 2

I made a few changes to the Triton_Server.Dockerfile. Specifically the name of the base image and instead of step 3: wget… I am using the commands mentioned in the README here.
Triton_Server_newcmd.Dockerfile.txt (2.1 KB)

Getting the following error now -

nvidia@ubuntu:~/ocr_nvidia/NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton$ sudo bash setup_triton_server.sh onnx_models/ocdnet.onnx onnx_models/ocrnet.onnx onnx_models/character_list.txt
Set input size to HxW: onnx_models/ocdnet.onnxxonnx_models/ocrnet.onnx and max batch size: onnx_models/character_list.txt for ocd tensorRT engine
[+] Building 2238.2s (15/17)                                                                                                                                                                                                                                                                                   docker:default
 => [internal] load build definition from Triton_Server.Dockerfile                                                                                                                                                                                                                                                       0.3s
 => => transferring dockerfile: 2.22kB                                                                                                                                                                                                                                                                                   0.0s
 => [internal] load .dockerignore                                                                                                                                                                                                                                                                                        0.3s
 => => transferring context: 2B                                                                                                                                                                                                                                                                                          0.0s
 => [internal] load metadata for nvcr.io/nvidia/deepstream-l4t:6.2-triton                                                                                                                                                                                                                                                1.3s
 => CACHED [ 1/13] FROM nvcr.io/nvidia/deepstream-l4t:6.2-triton@sha256:17e6c798d9772fa85d88594121fbdce9c4e25a94cf24196255ec08d49d5299f6                                                                                                                                                                                 0.0s
 => [internal] load build context                                                                                                                                                                                                                                                                                      104.9s
 => => transferring context: 797.19MB                                                                                                                                                                                                                                                                                  104.9s
 => [ 2/13] RUN mkdir -p /opt/nvocdr && cd /opt/nvocdr                                                                                                                                                                                                                                                                   7.8s
 => [ 3/13] RUN mkdir -p /opt/nvocdr/onnx_model                                                                                                                                                                                                                                                                          4.5s
 => [ 4/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton/models/ocdnet.onnx /opt/nvocdr/onnx_model/ocdnet.onnx                                                                                                                                                                                2.9s
 => [ 5/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton/models/ocrnet.onnx /opt/nvocdr/onnx_model/ocrnet.onnx                                                                                                                                                                                1.9s
 => [ 6/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution/triton/models/character_list /opt/nvocdr/onnx_model/character_list                                                                                                                                                                          0.8s
 => [ 7/13] RUN ls -l /opt/nvocdr/onnx_model/                                                                                                                                                                                                                                                                            4.4s
 => [ 8/13] RUN git clone -b release/8.6 https://github.com/NVIDIA/TensorRT.git && cd TensorRT && git submodule update --init --recursive &&     mkdir build && cd build && cmake .. -DTRT_LIB_DIR=/usr/lib/aarch64-linux-gnu/ && make nvinfer_plugin -j4 &&     cp libnvinfer_plugin.so.8.6.1 /usr/lib/aarch64-linu  2058.0s 
 => [ 9/13] RUN apt-get update && apt-get install libgl1-mesa-glx --yes && apt-get install libopencv-dev --yes                                                                                                                                                                                                          16.9s 
 => [10/13] COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution /opt/nvocdr/ocdr                                                                                                                                                                                                                            2.1s 
 => ERROR [11/13] RUN cd /opt/nvocdr/ocdr/triton &&     python3 -m pip install --upgrade pip &&     python3 -m pip install nvidia-pyindex &&     python3 -m pip install -r requirements-pip.txt                                                                                                                         42.7s 
------                                                                                                                                                                                                                                                                                                                        
 > [11/13] RUN cd /opt/nvocdr/ocdr/triton &&     python3 -m pip install --upgrade pip &&     python3 -m pip install nvidia-pyindex &&     python3 -m pip install -r requirements-pip.txt:                                                                                                                                     
1.545 Requirement already satisfied: pip in /usr/local/lib/python3.8/dist-packages (22.3.1)                                                                                                                                                                                                                                   
1.904 Collecting pip                                                                                                                                                                                                                                                                                                          
2.072   Downloading pip-24.0-py3-none-any.whl (2.1 MB)                                                                                                                                                                                                                                                                        
2.257      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 11.9 MB/s eta 0:00:00                                                                                                                                                                                                                                          
2.411 Installing collected packages: pip
2.411   Attempting uninstall: pip
2.413     Found existing installation: pip 22.3.1
2.766     Uninstalling pip-22.3.1:
3.343       Successfully uninstalled pip-22.3.1
5.306 Successfully installed pip-24.0
5.307 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
7.560 Collecting nvidia-pyindex
7.752   Downloading nvidia-pyindex-1.0.9.tar.gz (10 kB)
8.057   Preparing metadata (setup.py): started
13.01   Preparing metadata (setup.py): finished with status 'done'
13.02 Building wheels for collected packages: nvidia-pyindex
13.03   Building wheel for nvidia-pyindex (setup.py): started
19.19   Building wheel for nvidia-pyindex (setup.py): finished with status 'done'
19.20   Created wheel for nvidia-pyindex: filename=nvidia_pyindex-1.0.9-py3-none-any.whl size=8398 sha256=dbc4365f9c4a0fa2ef120ff5537650dc618bb9de8e4e072f3f8c8f6cad95830d
19.20   Stored in directory: /root/.cache/pip/wheels/e0/c2/fb/5cf4e1cfaf28007238362cb746fb38fc2dd76348331a748d54
19.20 Successfully built nvidia-pyindex
19.30 Installing collected packages: nvidia-pyindex
19.57 Successfully installed nvidia-pyindex-1.0.9
19.57 WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
20.51 Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
21.58 Collecting pynvjpeg (from -r requirements-pip.txt (line 1))
21.75   Downloading pynvjpeg-0.0.13.tar.gz (11 kB)
21.77   Preparing metadata (setup.py): started
25.29   Preparing metadata (setup.py): finished with status 'done'
25.77 Collecting pybind11 (from -r requirements-pip.txt (line 2))
25.81   Downloading pybind11-2.12.0-py3-none-any.whl.metadata (9.5 kB)
26.16 Collecting python-config (from -r requirements-pip.txt (line 3))
26.21   Downloading python-config-0.1.2.tar.gz (4.7 kB)
26.22   Preparing metadata (setup.py): started
27.17   Preparing metadata (setup.py): finished with status 'done'
27.60 Collecting opencv-python (from -r requirements-pip.txt (line 4))
27.63   Downloading opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (20 kB)
27.63 Requirement already satisfied: pycuda==2022.2.2 in /usr/local/lib/python3.8/dist-packages (from -r requirements-pip.txt (line 5)) (2022.2.2)
27.64 Requirement already satisfied: pytools>=2011.2 in /usr/local/lib/python3.8/dist-packages (from pycuda==2022.2.2->-r requirements-pip.txt (line 5)) (2022.1.14)
27.65 Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python3.8/dist-packages (from pycuda==2022.2.2->-r requirements-pip.txt (line 5)) (1.4.4)
27.65 Requirement already satisfied: mako in /usr/local/lib/python3.8/dist-packages (from pycuda==2022.2.2->-r requirements-pip.txt (line 5)) (1.2.4)
27.65 Requirement already satisfied: numpy>=1.17 in /usr/local/lib/python3.8/dist-packages (from pynvjpeg->-r requirements-pip.txt (line 1)) (1.24.1)
27.70 Requirement already satisfied: platformdirs>=2.2.0 in /usr/local/lib/python3.8/dist-packages (from pytools>=2011.2->pycuda==2022.2.2->-r requirements-pip.txt (line 5)) (2.6.2)
27.70 Requirement already satisfied: typing-extensions>=4.0 in /usr/local/lib/python3.8/dist-packages (from pytools>=2011.2->pycuda==2022.2.2->-r requirements-pip.txt (line 5)) (4.4.0)
27.71 Requirement already satisfied: MarkupSafe>=0.9.2 in /usr/local/lib/python3.8/dist-packages (from mako->pycuda==2022.2.2->-r requirements-pip.txt (line 5)) (2.1.1)
27.76 Downloading pybind11-2.12.0-py3-none-any.whl (234 kB)
27.81    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 235.0/235.0 kB 5.9 MB/s eta 0:00:00
27.84 Downloading opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (41.3 MB)
29.78    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.3/41.3 MB 24.5 MB/s eta 0:00:00
30.03 Building wheels for collected packages: pynvjpeg, python-config
30.04   Building wheel for pynvjpeg (setup.py): started
38.94   Building wheel for pynvjpeg (setup.py): finished with status 'error'
38.97   error: subprocess-exited-with-error
38.97   
38.97   × python setup.py bdist_wheel did not run successfully.
38.97   │ exit code: 1
38.97   ╰─> [19 lines of output]
38.97       running bdist_wheel
38.97       running build
38.97       running build_ext
38.97       building 'nvjpeg' extension
38.97       creating build
38.97       creating build/temp.linux-aarch64-3.8
38.97       creating build/temp.linux-aarch64-3.8/src
38.97       creating build/temp.linux-aarch64-3.8/src/x86
38.97       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=x86 -Iinclude -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c nvjpeg-python.cpp -o build/temp.linux-aarch64-3.8/nvjpeg-python.o
38.97       nvjpeg-python.cpp: In function ‘PyObject* NvJpeg_decode(NvJpeg*, PyObject*)’:
38.97       nvjpeg-python.cpp:66:27: warning: catching polymorphic type ‘class JpegCoderError’ by value [-Wcatch-value=]
38.97          66 |     }catch(JpegCoderError e){
38.97             |                           ^
38.97       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=x86 -Iinclude -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c src/x86/JpegCoder.cpp -o build/temp.linux-aarch64-3.8/src/x86/JpegCoder.o
38.97       src/x86/JpegCoder.cpp:2:10: fatal error: nvjpeg.h: No such file or directory
38.97           2 | #include <nvjpeg.h>
38.97             |          ^~~~~~~~~~
38.97       compilation terminated.
38.97       error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
38.97       [end of output]
38.97   
38.97   note: This error originates from a subprocess, and is likely not a problem with pip.
38.97   ERROR: Failed building wheel for pynvjpeg
38.97   Running setup.py clean for pynvjpeg
40.22   Building wheel for python-config (setup.py): started
41.17   Building wheel for python-config (setup.py): finished with status 'done'
41.17   Created wheel for python-config: filename=python_config-0.1.2-py3-none-any.whl size=2928 sha256=ac6dcd31d69a3b52c1a9cfe7cc1123fc17457298f0d6542c220923c06f976edd
41.17   Stored in directory: /tmp/pip-ephem-wheel-cache-5gyknc5y/wheels/30/2b/9b/e60f38597c2033eca10b75ec8638b0434100181eb21d81e914
41.18 Successfully built python-config
41.18 Failed to build pynvjpeg
41.18 ERROR: Could not build wheels for pynvjpeg, which is required to install pyproject.toml-based projects
------
Triton_Server.Dockerfile:36
--------------------
  35 |     COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution /opt/nvocdr/ocdr
  36 | >>> RUN cd /opt/nvocdr/ocdr/triton && \
  37 | >>>     python3 -m pip install --upgrade pip && \
  38 | >>>     python3 -m pip install nvidia-pyindex && \
  39 | >>>     python3 -m pip install -r requirements-pip.txt
  40 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /opt/nvocdr/ocdr/triton &&     python3 -m pip install --upgrade pip &&     python3 -m pip install nvidia-pyindex &&     python3 -m pip install -r requirements-pip.txt" did not complete successfully: exit code: 1

Hi @fanzh, after some more tweaking of the code (removed pynjpeg from the requirements.txt, NvJpeg occurrences in code - model.py, client.py etc and few other things), I have been able to load the models on a triton server hosted on the Jetson. However, during inferencing I get the following error on the server side

I0424 01:24:22.338174 295 libtorch.cc:2253] TRITONBACKEND_Initialize: pytorch
I0424 01:24:22.339147 295 libtorch.cc:2263] Triton TRITONBACKEND API version: 1.13
I0424 01:24:22.339841 295 libtorch.cc:2269] 'pytorch' TRITONBACKEND API version: 1.13
I0424 01:24:24.205457 295 pinned_memory_manager.cc:240] Pinned memory pool is created at '0x2181d2000' with size 268435456
I0424 01:24:24.206531 295 cuda_memory_manager.cc:105] CUDA memory pool is created on device 0 with size 67108864
I0424 01:24:24.217539 295 model_lifecycle.cc:462] loading: nvOCDR:1
I0424 01:24:25.977171 295 python_be.cc:2055] TRITONBACKEND_ModelInstanceInitialize: nvOCDR (CPU device 0)
[nvOCDR] Init...
[nvOCDR] Load OCD tensorRT engine from: /opt/nvocdr/engines/ocdnet.fp16.engine
[nvOCDR] Load OCD tensorRT engine from: /opt/nvocdr/engines/ocrnet.fp16.engine
I0424 01:24:30.362025 295 model_lifecycle.cc:815] successfully loaded 'nvOCDR'
I0424 01:24:30.362211 295 server.cc:603] 
+------------------+------+
| Repository Agent | Path |
+------------------+------+
+------------------+------+

I0424 01:24:30.362469 295 server.cc:630] 
+---------+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Backend | Path                                                    | Config                                                                                                                                                        |
+---------+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+
| pytorch | /opt/tritonserver/backends/pytorch/libtriton_pytorch.so | {}                                                                                                                                                            |
| python  | /opt/tritonserver/backends/python/libtriton_python.so   | {"cmdline":{"auto-complete-config":"true","backend-directory":"/opt/tritonserver/backends","min-compute-capability":"5.300000","default-max-batch-size":"4"}} |
+---------+---------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------+

I0424 01:24:30.362569 295 server.cc:673] 
+--------+---------+--------+
| Model  | Version | Status |
+--------+---------+--------+
| nvOCDR | 1       | READY  |
+--------+---------+--------+

W0424 01:24:30.362597 295 metrics.cc:352] No polling metrics (CPU, GPU) are enabled. Will not poll for them.
I0424 01:24:30.362775 295 tritonserver.cc:2385] 
+----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Option                           | Value                                                                                                                                                                                                           |
+----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| server_id                        | triton                                                                                                                                                                                                          |
| server_version                   | 2.35.0                                                                                                                                                                                                          |
| server_extensions                | classification sequence model_repository model_repository(unload_dependents) schedule_policy model_configuration system_shared_memory cuda_shared_memory binary_tensor_data parameters statistics trace logging |
| model_repository_path[0]         | /opt/nvocdr/ocdr/triton/models/                                                                                                                                                                                 |
| model_control_mode               | MODE_NONE                                                                                                                                                                                                       |
| strict_model_config              | 0                                                                                                                                                                                                               |
| rate_limit                       | OFF                                                                                                                                                                                                             |
| pinned_memory_pool_byte_size     | 268435456                                                                                                                                                                                                       |
| cuda_memory_pool_byte_size{0}    | 67108864                                                                                                                                                                                                        |
| min_supported_compute_capability | 5.3                                                                                                                                                                                                             |
| strict_readiness                 | 1                                                                                                                                                                                                               |
| exit_timeout                     | 30                                                                                                                                                                                                              |
| cache_enabled                    | 0                                                                                                                                                                                                               |
+----------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

I0424 01:24:30.372096 295 grpc_server.cc:2445] Started GRPCInferenceService at 0.0.0.0:8001
I0424 01:24:30.372687 295 http_server.cc:3555] Started HTTPService at 0.0.0.0:8000
I0424 01:24:30.414835 295 http_server.cc:185] Started Metrics Service at 0.0.0.0:8002
[nvOCDR] Infer...
[ERROR] The OCDNet inference channel should be 1 or 3.
[nvOCDR] Infer done, got 0 texts 

Attaching the client side error below

root@ubuntu:/opt/nvocdr/triton# python3 client.py -d /images/ -bs 1 --url <ip>:8001
/usr/local/lib/python3.8/dist-packages/tritongrpcclient/__init__.py:33: DeprecationWarning: The package `tritongrpcclient` is deprecated and will be removed in a future version. Please use instead `tritonclient.grpc`
  warnings.warn(
[nvOCDR] Find total 2 images in /images/
[nvOCDR] Processing for: /images/img_1.jpg, image size: (222, 320, 3)
Traceback (most recent call last):
  File "client.py", line 147, in <module>
    results = triton_client.infer(model_name=args.model_name,
  File "/usr/local/lib/python3.8/dist-packages/tritonclient/grpc/_client.py", line 1572, in infer
    raise_error_grpc(rpc_error)
  File "/usr/local/lib/python3.8/dist-packages/tritonclient/grpc/_utils.py", line 77, in raise_error_grpc
    raise get_error_grpc(rpc_error) from None
tritonclient.utils.InferenceServerException: [StatusCode.INTERNAL] Failed to process the request(s) for model instance 'nvOCDR', message: ValueError: cannot reshape array of size 0 into shape (0,newaxis)

At:
  /opt/nvocdr/ocdr/triton/models/nvOCDR/1/model.py(181): execute

Line 181 for me in model.py is this line. I printed the content of “output” and it is an empty array i.e no text detected/recognized. Is that the reason this error is thrown? Any insights will be great. Thank you!

seems this is the error tip. please check from Python side.

@fanzh I have managed to resolve the previous issue by setting the is_high_resolution_input in the spec.json file to False. I am able to see inferences for my images now.

I was also able to install pynvjpeg by following the steps mentioned here - specifically volume mounting /usr/src/jetson_multimedia_api.

However I have a few more questions

  1. How can I pip install pynvjpeg as part of my Dockerfile itself? I tried copying /usr/src/jetson_multimedia_api in the build itself but it throws the error below during the pip install
16.53 Downloading pybind11-2.12.0-py3-none-any.whl (234 kB)
16.57    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 235.0/235.0 kB 6.1 MB/s eta 0:00:00
16.59 Downloading opencv_python-4.9.0.80-cp37-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (41.3 MB)
18.99    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.3/41.3 MB 18.8 MB/s eta 0:00:00
19.08 Building wheels for collected packages: pynvjpeg, python-config
19.08   Building wheel for pynvjpeg (setup.py): started
30.20   Building wheel for pynvjpeg (setup.py): finished with status 'error'
30.23   error: subprocess-exited-with-error
30.23   
30.23   × python setup.py bdist_wheel did not run successfully.
30.23   │ exit code: 1
30.23   ╰─> [36 lines of output]
30.23       make: Nothing to be done for 'lib_cuda'.
30.23       running bdist_wheel
30.23       running build
30.23       running build_ext
30.23       building 'nvjpeg' extension
30.23       creating build/temp.linux-aarch64-3.8
30.23       creating build/temp.linux-aarch64-3.8/src
30.23       creating build/temp.linux-aarch64-3.8/src/jetson
30.23       creating build/temp.linux-aarch64-3.8/usr
30.23       creating build/temp.linux-aarch64-3.8/usr/src
30.23       creating build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api
30.23       creating build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples
30.23       creating build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common
30.23       creating build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes
30.23       creating build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/argus
30.23       creating build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/argus/samples
30.23       creating build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/argus/samples/utils
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c nvjpeg-python.cpp -o build/temp.linux-aarch64-3.8/nvjpeg-python.o
30.23       nvjpeg-python.cpp: In function ‘PyObject* NvJpeg_decode(NvJpeg*, PyObject*)’:
30.23       nvjpeg-python.cpp:66:27: warning: catching polymorphic type ‘class JpegCoderError’ by value [-Wcatch-value=]
30.23          66 |     }catch(JpegCoderError e){
30.23             |                           ^
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c src/jetson/JpegCoder.cpp -o build/temp.linux-aarch64-3.8/src/jetson/JpegCoder.o
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c /usr/src/jetson_multimedia_api/samples/common/classes/NvJpegDecoder.cpp -o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvJpegDecoder.o
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c /usr/src/jetson_multimedia_api/samples/common/classes/NvJpegEncoder.cpp -o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvJpegEncoder.o
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c /usr/src/jetson_multimedia_api/samples/common/classes/NvBuffer.cpp -o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvBuffer.o
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c /usr/src/jetson_multimedia_api/samples/common/classes/NvElement.cpp -o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvElement.o
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c /usr/src/jetson_multimedia_api/samples/common/classes/NvLogging.cpp -o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvLogging.o
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c /usr/src/jetson_multimedia_api/samples/common/classes/NvElementProfiler.cpp -o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvElementProfiler.o
30.23       aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DJPEGCODER_ARCH=jetson -Iinclude -I/usr/src/jetson_multimedia_api/argus/samples/utils -I/usr/src/jetson_multimedia_api/include -I/usr/src/jetson_multimedia_api/include/libjpeg-8b -I/usr/local/lib/python3.8/dist-packages/numpy/core/include -I/usr/local/cuda/include -I/usr/include/python3.8 -c /usr/src/jetson_multimedia_api/argus/samples/utils/CUDAHelper.cpp -o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/argus/samples/utils/CUDAHelper.o
30.23       creating build/lib.linux-aarch64-3.8
30.23       aarch64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-aarch64-3.8/nvjpeg-python.o build/temp.linux-aarch64-3.8/src/jetson/JpegCoder.o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvJpegDecoder.o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvJpegEncoder.o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvBuffer.o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvElement.o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvLogging.o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/samples/common/classes/NvElementProfiler.o build/temp.linux-aarch64-3.8/usr/src/jetson_multimedia_api/argus/samples/utils/CUDAHelper.o -L/usr/lib/aarch64-linux-gnu/tegra -Lbuild/lib -L/usr/local/cuda/lib64 -lcolor_space -lcudart -lnvjpeg -lcuda -lcudart -lnvjpeg -o build/lib.linux-aarch64-3.8/nvjpeg.cpython-38-aarch64-linux-gnu.so
30.23       /usr/bin/ld: cannot find -lnvjpeg
30.23       /usr/bin/ld: cannot find -lnvjpeg
30.23       collect2: error: ld returned 1 exit status
30.23       error: command 'aarch64-linux-gnu-g++' failed with exit status 1
30.23       [end of output]
30.23   
30.23   note: This error originates from a subprocess, and is likely not a problem with pip.
30.23   ERROR: Failed building wheel for pynvjpeg
30.23   Running setup.py clean for pynvjpeg
30.63   Building wheel for python-config (setup.py): started
31.08   Building wheel for python-config (setup.py): finished with status 'done'
31.09   Created wheel for python-config: filename=python_config-0.1.2-py3-none-any.whl size=2928 sha256=7ddfaadc8ffc0766a72fdd0366e017af808d357380e4a7c6d5c98fd1abeb22df
31.09   Stored in directory: /tmp/pip-ephem-wheel-cache-4ytrhl1z/wheels/30/2b/9b/e60f38597c2033eca10b75ec8638b0434100181eb21d81e914
31.09 Successfully built python-config
31.09 Failed to build pynvjpeg
31.09 ERROR: Could not build wheels for pynvjpeg, which is required to install pyproject.toml-based projects
------
Dockerfile_with_ocr:57
--------------------
  56 |     COPY NVIDIA-Optical-Character-Detection-and-Recognition-Solution /opt/nvocdr/ocdr
  57 | >>> RUN cd /opt/nvocdr/ocdr/triton && \
  58 | >>>     python3 -m pip install --upgrade pip && \
  59 | >>>     python3 -m pip install nvidia-pyindex && \
  60 | >>>     python3 -m pip install -r requirements-pip.txt
  61 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /opt/nvocdr/ocdr/triton &&     python3 -m pip install --upgrade pip &&     python3 -m pip install nvidia-pyindex &&     python3 -m pip install -r requirements-pip.txt" did not complete successfully: exit code: 1
  1. I am able to install the pynvjpeg package manually inside the container after it is run for the triton server and client. However, with this package installed, I get the following CUDA error on the client side. Any idea about this? -
root@ubuntu:/enhancement# python3 client.py -d /data/images/test_img/ -bs 1 --url localhost:8001
/usr/local/lib/python3.8/dist-packages/tritongrpcclient/__init__.py:33: DeprecationWarning: The package `tritongrpcclient` is deprecated and will be removed in a future version. Please use instead `tritonclient.grpc`
  warnings.warn(
[nvOCDR] Find total 2 images in /data/images/test_img/
Initializing CUDA
NvMMLiteBlockCreate : Block : BlockType = 256 
[JPEG Decode] BeginSequence Display WidthxHeight 1118x1063
NvMMLiteBlockCreate : Block : BlockType = 1 
[nvOCDR] Processing for: /data/images/test_img/scene_text.jpg, image size: (1063, 1118, 3)
Traceback (most recent call last):
  File "client.py", line 147, in <module>
    results = triton_client.infer(model_name=args.model_name,
  File "/usr/local/lib/python3.8/dist-packages/tritonclient/grpc/_client.py", line 1572, in infer
    raise_error_grpc(rpc_error)
  File "/usr/local/lib/python3.8/dist-packages/tritonclient/grpc/_utils.py", line 77, in raise_error_grpc
    raise get_error_grpc(rpc_error) from None
tritonclient.utils.InferenceServerException: [StatusCode.INTERNAL] Failed to process the request(s) for model instance 'nvOCDR', message: LogicError: cuFuncSetBlockShape failed: invalid resource handle

At:
  /usr/local/lib/python3.8/dist-packages/pycuda/driver.py(481): function_call
  /opt/nvocdr/ocdr/triton/utils/cuda_resize_keep_AR.py(169): image_resize
  /opt/nvocdr/ocdr/triton/utils/process.py(87): preprocess
  /opt/nvocdr/ocdr/triton/models/nvOCDR/1/model.py(160): execute

[JPEG Decode] NvMMLiteJPEGDecBlockPrivateClose done
[JPEG Decode] NvMMLiteJPEGDecBlockClose done
  1. I am able to get inference results without pynvjpeg however the inference time per file is usually above 100 - 200ms (this is printed on the server) by nvocdr itself. Image size varies between 500x200 to 1200x1000. Is this inference time expected?
    Screenshot 2024-04-24 at 8.59.21 PM

@fanzh @AastaLLL any thoughts on this?

One more question, I get this log while launching the Triton Server with nvocdr model

I0424 01:24:25.977171 295 python_be.cc:2055] TRITONBACKEND_ModelInstanceInitialize: nvOCDR (CPU device 0) here

I see the warpInfer() / warpInferPatches() in pybind.cpp place data on the GPU from the host + gpu usage spiking during calls to the server. I’ve read these posts but I want to confirm that nvocdr model is using GPU for inferencing on Jetson Orin NX with JP5.1.2? References below -

  1. How to serve Python models on GPU · Issue #5889 · triton-inference-server/server · GitHub
  2. Does Python backend in Triton Server for Jetson supports GPU?

the four questions above would be outside of DeepStream. please refer to this topic for installing pynvjpeg. about triton issue, you can ask in triton channel or ask the author by this channel. Thanks!

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.