zerollzeng / tensorrt-zoo

openpose, yolov3 with tiny-tensorrt
86 stars 25 forks source link

compile failed-NvInfer.h cannot found #11

Closed MolianWH closed 4 years ago

MolianWH commented 4 years ago

when make, it occurs errors as fallow image

image

I run the command as fallow to clone tensorrt-zoo. git clone --recursive https://github.com/zerollzeng/tensorrt-zoo.git

My TensorRT version is 6.0.1.5. It success when run the TensorRT sample test. But it seems that tiny-tensorrt can not find tensorRT include dir.

Do I need to change TensorRT install path? What's your directory structure?

Thanks!

MolianWH commented 4 years ago

Hi, Are there more detailed installation instructions?I add TensorRT include folders manually, but there are so many errors when compile, such as missing OpenCV headers and missing link libraries etc.

MolianWH commented 4 years ago

Hi, Thanks for providing resources. The problems have been solved. It seems that the installation environment of TensorRT is different.

zerollzeng commented 4 years ago

Sorry for late reply, If you install tensorrt via official pkg file then the so should be in /usr/lib/x86_64-linux-gnu/, and the and the header file was in /usr/include/x86_64-linux-gnu/. if you hava different tensorrt installation path then you should add the path in CMakeLists.txt, I havn't try it before, but it should works. Also if your problem has been solve, can you kindly post your solution so that other people could benifit from you?

MolianWH commented 4 years ago

Here are errors I met and solutions.

  1. cmake -D BUILD_PYTHON=ON .. not cmake -D PYTHON_API ON ..
  2. error: ‘CV_BGR2RGB’ was not declared in this scope cv::cvtColor(img, rgb, CV_BGR2RGB); solutions: findyolo3test.cpp,and add include file as fallow:
    #include <opencv2/imgproc/types_c.h>
  3. errors with TensorRT envs solutions: find CMakeLists.txt in root path, and add include dir and libs dir :
# TensorRT
set(TENSORRT_ROOT "/home/dreamdeck/Downloads/TensorRT-6.0.1.5")
find_path(TENSORRT_INCLUDE_DIR NvInfer.h
  HINTS ${TENSORRT_ROOT} ${CUDA_TOOLKIT_ROOT_DIR}
  PATH_SUFFIXES include)
MESSAGE(STATUS "Found TensorRT headers at ${TENSORRT_INCLUDE_DIR}")
include_directories(${TENSORRT_INCLUDE_DIR})
   link_directories(your_TensorRT_Path)
  1. There is also an error when run testopenpose error: terminate called after throwing an instance of 'std::invalid_argument' what(): stoi Aborted (core dumped) solutions: run as

    path/to/testopenpose --prototxt path/to/prototxt --caffemodel path/to/caffemodel/ --save_engine path/to/save_engin --input path/to/input/img --run_mode 1

    run_mode = 1 means setFp16Mode run_mode = 2 means set int8 inference mode there suggests @zerollzeng write to README.md

  2. don't generate *.engine file haven't solved.

zerollzeng commented 4 years ago

Thanks for your kindly contribution! I will update docs fo tensorrt-zoo, and if you don't want to generate .engine file, just pass enginefilename with "" empty string

zerollzeng commented 4 years ago

Already update documentation @MolianWH, Please note that tensorrt-zoo is not compatible with latest tiny-tensorrt because updated api

zerollzeng commented 4 years ago

your command is --save instead of --save_engine?

weilanShi commented 4 years ago

Here are errors I met and solutions.

1. cmake -D BUILD_PYTHON=ON ..   not  cmake -D PYTHON_API ON ..

2. error:  ‘CV_BGR2RGB’ was not declared in this scope
   cv::cvtColor(img, rgb, CV_BGR2RGB);
   solutions: find[yolo3test.cpp](./yolov3/yolo3test.cpp),and add include file as fallow:
#include <opencv2/imgproc/types_c.h>
1. errors with TensorRT envs
   solutions: find [CMakeLists.txt](./CMakeLists.txt) in root path, and add include dir and libs dir :
# TensorRT
set(TENSORRT_ROOT "/home/dreamdeck/Downloads/TensorRT-6.0.1.5")
find_path(TENSORRT_INCLUDE_DIR NvInfer.h
  HINTS ${TENSORRT_ROOT} ${CUDA_TOOLKIT_ROOT_DIR}
  PATH_SUFFIXES include)
MESSAGE(STATUS "Found TensorRT headers at ${TENSORRT_INCLUDE_DIR}")
include_directories(${TENSORRT_INCLUDE_DIR})
   link_directories(your_TensorRT_Path)
1. There is also an error when run testopenpose
   error: terminate called after throwing an instance of 'std::invalid_argument'   what():  stoi Aborted (core dumped)
   solutions:
   run as
path/to/testopenpose --prototxt path/to/prototxt --caffemodel path/to/caffemodel/ --save_engine path/to/save_engin --input path/to/input/img --run_mode 1

run_mode = 1 means setFp16Mode run_mode = 2 means set int8 inference mode there suggests @zerollzeng write to README.md

1. don't generate *.engine file
   haven't solved.

I met the same error : terminate called after throwing an instance of 'std::invalid_argument' what(): stoi Aborted

and there is my command: ./testopenpose --prototxt pose_deploy.prototxt --caffemodel pose_iter_584000.caffemodel --save_engine ./save_engine --input test.jpg could you tell me how to solve it?

zerollzeng commented 4 years ago

I met the same error : terminate called after throwing an instance of 'std::invalid_argument' what(): stoi Aborted

and there is my command: ./testopenpose --prototxt pose_deploy.prototxt --caffemodel pose_iter_584000.caffemodel --save_engine ./save_engine --input test.jpg could you tell me how to solve it?

https://github.com/zerollzeng/tensorrt-zoo/blob/238c83103bb97aa799ebc67f4dee583e1939fe20/openpose/testopenpose.cpp#L48

arguments are missing, please take a look at testopenpose.cpp