wang-xinyu / tensorrtx

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

执行make时出错:/usr/bin/ld: cannot find -lnvinfer #45

Closed Jinjicheng closed 4 years ago

Jinjicheng commented 4 years ago

我是用tar方式安装的tensorrt7.0,cmake时的显示如下: jinjicheng@ubuntu:~/project/object-detection/tensorrtx/yolov4/build$ cmake -DCMAKE_INCLUDE_PATH='/home/jinjicheng/ENV/tensorrt-7.0/include' .. -- The C compiler identification is GNU 7.4.0 -- The CXX compiler identification is GNU 7.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 -- Found CUDA: /home/jinjicheng/ENV/cuda-10.0 (found version "10.0") embed_platform off -- Found OpenCV: /usr/local (found version "4.1.0") -- Configuring done -- Generating done -- Build files have been written to: /home/jinjicheng/project/object-detection/tensorrtx/yolov4/build 然后执行make时出现以下错误: [100%] Linking CXX executable yolov4 /usr/bin/ld: cannot find -lnvinfer collect2: error: ld returned 1 exit status CMakeFiles/yolov4.dir/build.make:144: recipe for target 'yolov4' failed make[2]: [yolov4] Error 1 CMakeFiles/Makefile2:104: recipe for target 'CMakeFiles/yolov4.dir/all' failed make[1]: [CMakeFiles/yolov4.dir/all] Error 2 Makefile:83: recipe for target 'all' failed make: *** [all] Error 2

wang-xinyu commented 4 years ago

tar安装,需要改下cmake,链接到nvinfer so所在的地方

Jinjicheng commented 4 years ago

我添加了include路径:cmake -DCMAKE_INCLUDE_PATH='/home/jinjicheng/ENV/tensorrt-7.0/inlucde/'

wang-xinyu commented 4 years ago

加了include路径能找到头文件,.so需要添加link路径

Jinjicheng commented 4 years ago

你这套yolov4加速的代码支持tensorrt5.1版本吗

wang-xinyu commented 4 years ago

master分支用的7.0的api,可能有的接口在5.1没定义。 用trt4分支,5.1应该可以跑 https://github.com/wang-xinyu/tensorrtx/tree/trt4/yolov4

Jinjicheng commented 4 years ago

加了include路径能找到头文件,.so需要添加link路径

请问要怎么添加so的link路径,这方面我不是很懂

wang-xinyu commented 4 years ago

这个是c++的基础知识了,cmake,去学学,兄弟

Jinjicheng commented 4 years ago

ln -s libnvinfer.so.7 libnvinfer.so 用这条命令就解决了 多谢大佬的指导,最终成功了 加速后的速度在14ms左右,没有v3加速后的快啊(9ms左右),这是什么情况呢

wang-xinyu commented 4 years ago

yolov4本身网络比yolov3大, 另外慢的一个主要因素是yolov4用了mish, 比yolov3的leaky relu慢。

Jinjicheng commented 4 years ago

好的,明白了 最近出的yolov5,大佬看了没,这个能否用trt加速

wang-xinyu commented 4 years ago

因为yolov5命名的争议,而且项目频繁更新,还不在一个稳定的状态,之前没做,最近比较忙,后面应该会做