wang-xinyu / tensorrtx

Implementation of popular deep learning networks with TensorRT network definition API
MIT License
7.04k stars 1.78k forks source link

YOLOv9 build error #1481

Open reaganch opened 7 months ago

reaganch commented 7 months ago

Env

About this repo

Your problem

reaganch commented 7 months ago

I presume this may be because TensorRTX needs an older version of TensorRT installed? Would be great if you could confirm. Thanks!

wang-xinyu commented 7 months ago

Yes, try to use TensorRT <= 8.5

reaganch commented 7 months ago

Thanks for that. Will give it a shot. Cheers!

reaganch commented 7 months ago

Just installed TensorRT version 8.5 GA Update 2. This required installing CUDA version 11.8.0 and cuDNN version 8.9.7. I had previously installed CUDA version 12.3.2 to build OpenCV, so I currently have two installations of CUDA on my system. When I try to build TensorRTX for yolov9, I now get the following error when I run cmake ... Could you please advise what I may be doing wrong here and why it seems to be requiring CUDA 12.3?

% cmake ..
-- The C compiler identification is GNU 11.4.0
-- The CXX compiler identification is GNU 11.4.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- operation system is Linux-6.5.0-26-generic
-- current platform: Linux 
-- The CUDA compiler identification is NVIDIA 11.8.89
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
CMake Warning (dev) at /usr/local/lib/cmake/opencv4/OpenCVConfig.cmake:86 (find_package):
  Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
  --help-policy CMP0146" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

Call Stack (most recent call first):
  /usr/local/lib/cmake/opencv4/OpenCVConfig.cmake:108 (find_host_package)
  CMakeLists.txt:41 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
CMake Error at /home/cricket/.local/lib/python3.10/site-packages/cmake/data/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find CUDA: Found unsuitable version "11.8", but required is exact
  version "12.3" (found /usr/local/cuda-11.8)
Call Stack (most recent call first):
  /home/cricket/.local/lib/python3.10/site-packages/cmake/data/share/cmake-3.29/Modules/FindPackageHandleStandardArgs.cmake:598 (_FPHSA_FAILURE_MESSAGE)
  /home/cricket/.local/lib/python3.10/site-packages/cmake/data/share/cmake-3.29/Modules/FindCUDA.cmake:1291 (find_package_handle_standard_args)
  /usr/local/lib/cmake/opencv4/OpenCVConfig.cmake:86 (find_package)
  /usr/local/lib/cmake/opencv4/OpenCVConfig.cmake:108 (find_host_package)
  CMakeLists.txt:41 (find_package)

-- Configuring incomplete, errors occurred!

Thanks!

wang-xinyu commented 7 months ago

Seems your opencv is linking cuda12.3, you can try to use docker

reaganch commented 7 months ago

Ah, I see. Thanks for the suggestion. Will give that a shot.

zmtttt commented 7 months ago

root@b37d8b2aacd1:/workspace/tensorrtx/yolov9/build# sudo ./yolov9 -s ../yolov9-c.wts yolov9-c.engine c [04/22/2024-13:15:57] [W] [TRT] The implicit batch dimension mode has been deprecated. Please create the network with NetworkDefinitionCreationFlag::kEXPLICIT_BATCH flag whenever possible. Loading weights: ../yolov9-c.wts Your platform support int8: true Building engine, please wait for a while... reading calib cache: int8calib.table [04/22/2024-13:16:02] [W] [TRT] TensorRT was linked against cuDNN 8.6.0 but loaded cuDNN 8.5.0 [04/22/2024-13:16:03] [W] [TRT] TensorRT was linked against cuDNN 8.6.0 but loaded cuDNN 8.5.0 [04/22/2024-13:16:03] [W] [TRT] TensorRT was linked against cuDNN 8.6.0 but loaded cuDNN 8.5.0 [04/22/2024-13:16:03] [E] [TRT] 1: Unexpected exception _Map_base::at [04/22/2024-13:16:03] [E] [TRT] 2: [builder.cpp::buildSerializedNetwork::751] Error Code 2: Internal Error (Assertion engine != nullptr failed. ) Build engine successfully! yolov9: /workspace/tensorrtx/yolov9/demo.cpp:31: void serialize_engine(unsigned int, std::string&, std::string&, std::string&): Assertion `serialized_engine != nullptr' failed. Aborted

wang-xinyu commented 7 months ago

@zmtttt have you check this path https://github.com/wang-xinyu/tensorrtx/blob/d4aa52db68c36d10cfcb2fd9a818faf2d82bfd00/yolov9/include/config.h#L13

wang-xinyu commented 7 months ago

@WuxinrongY Can we make yolov9 to use fp16 by default?

WuxinrongY commented 7 months ago

@WuxinrongY Can we make yolov9 to use fp16 by default?

zmtttt commented 7 months ago

@wang-xinyu ,谢谢,不过const static char* gCalibTablePath = "/home/zhaomt/com/tensorrtx/yolov9/calib/coco_calib",,还是同样的错误

WuxinrongY commented 7 months ago

@wang-xinyu ,谢谢,不过const static char* gCalibTablePath = "/home/zhaomt/com/tensorrtx/yolov9/calib/coco_calib",,还是同样的错误

这个路径后面要加“/”,比如const static char* gCalibTablePath = "/home/zhaomt/com/tensorrtx/yolov9/calib/coco_calib/"

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.