spacewalk01/tensorrt-yolov9

c++ inference result is empty

tianjiahao opened this issue · 3 comments

hello, I set opencv and tensorrt installation paths in CMakeLists.txt:

Find and include OpenCV

#set(OpenCV_DIR "your path to OpenCV")
set(OpenCV_DIR "/usr/local/opencv4/")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})

Set TensorRT path if not set in environment variables

#set(TENSORRT_DIR "your path to TensorRT")
set(TENSORRT_DIR "/var/lib/TensorRT-8.6.0.12/targets/x86_64-linux-gnu")

I use command ./yolov9-tensorrt ../../weights/yolov9-c-converted-fp16.engine ../data/images,but no result, the pop-up window is the original image, the environment is cuda 11.6, cudnn 8.4, tensorrt 8.6.0.12,

Hi, did you put opencv dll files in Release folder? for example, copy the opencv dll files such as opencv_world490.dll and opencv_videoio_ffmpeg490_64.dll into the /build/Release folder.

Hi, did you put opencv dll files in Release folder? for example, copy the opencv dll files such as opencv_world490.dll and opencv_videoio_ffmpeg490_64.dll into the /build/Release folder.

I use command cmake --build . --config Release, not find Release folde, but get "yolov9-tensorrt", and I not put opencv dll files

and I use command cmake ..

-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found CUDA: /usr/local/cuda (found version "11.6")
-- Found OpenCV: /usr/local/opencv4 (found version "4.9.0")
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/tjh/yolov9-main/TensorRT-YOLOv9-main/build
does it success?

thanks for your quick response, I find the reason. I use the WongKinYiu/yolov9 export.py, get the tensorrt engine file, use it and get no result, but it works in python.
use this command trtexec.exe --onnx=yolov9-c-converted.onnx --explicitBatch --saveEngine=yolov9-c.engine --fp16
this tensorrt engine is success!