wang-xinyu / tensorrtx

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

make crnn error! help #867

Closed vampireacen closed 2 years ago

vampireacen commented 2 years ago

Env

About this repo

Your problem

make crnn error

iic@iic-desktop:~/crnn.pytorch$ cp crnn.wts ../tensorrtx/crnn
iic@iic-desktop:~/crnn.pytorch$ cd ../tensorrtx/crnn
iic@iic-desktop:~/tensorrtx/crnn$ ls
CMakeLists.txt  crnn.cpp  crnn.wts  genwts.py  logging.h  README.md
iic@iic-desktop:~/tensorrtx/crnn$ mkdir build
iic@iic-desktop:~/tensorrtx/crnn$ cd build/
iic@iic-desktop:~/tensorrtx/crnn/build$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.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: /usr/local/cuda (found version "10.2")
embed_platform on
-- Found OpenCV: /usr (found version "4.1.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/iic/tensorrtx/crnn/build
iic@iic-desktop:~/tensorrtx/crnn/build$ make
Scanning dependencies of target crnn
[ 50%] Building CXX object CMakeFiles/crnn.dir/crnn.cpp.o
In file included from /home/iic/tensorrtx/crnn/crnn.cpp:7:0:
/home/iic/tensorrtx/crnn/logging.h:239:10: error: looser throw specifier for ‘virtual void Logger::log(nvinfer1::ILogger::Severity, const char*)’
     void log(Severity severity, const char* msg) override
          ^~~
In file included from /usr/include/aarch64-linux-gnu/NvInferLegacyDims.h:53:0,
                 from /usr/include/aarch64-linux-gnu/NvInfer.h:53,
                 from /home/iic/tensorrtx/crnn/crnn.cpp:5:
/usr/include/aarch64-linux-gnu/NvInferRuntimeCommon.h:1222:18: error:   overriding ‘virtual void nvinfer1::ILogger::log(nvinfer1::ILogger::Severity, const AsciiChar*) noexcept’
     virtual void log(Severity severity, AsciiChar const* msg) noexcept = 0;
                  ^~~
/home/iic/tensorrtx/crnn/crnn.cpp: In function ‘std::map<std::__cxx11::basic_string<char>, nvinfer1::Weights> loadWeights(std::__cxx11::string)’:
/home/iic/tensorrtx/crnn/crnn.cpp:62:29: error: variable ‘std::ifstream input’ has initializer but incomplete type
     std::ifstream input(file);
                             ^
/home/iic/tensorrtx/crnn/crnn.cpp: In function ‘nvinfer1::ILayer* addLSTM(nvinfer1::INetworkDefinition*, std::map<std::__cxx11::basic_string<char>, nvinfer1::Weights>&, nvinfer1::ITensor&, int, std::__cxx11::string)’:
/home/iic/tensorrtx/crnn/crnn.cpp:166:84: warning: ‘nvinfer1::IRNNv2Layer* nvinfer1::INetworkDefinition::addRNNv2(nvinfer1::ITensor&, int32_t, int32_t, int32_t, nvinfer1::RNNOperation)’ is deprecated [-Wdeprecated-declarations]
 o lstm = network->addRNNv2(input, 1, nHidden, dims.d[1], RNNOperation::kLSTM);
                                                                             ^
In file included from /home/iic/tensorrtx/crnn/crnn.cpp:5:0:
/usr/include/aarch64-linux-gnu/NvInfer.h:6065:33: note: declared here
     TRT_DEPRECATED IRNNv2Layer* addRNNv2(
                                 ^~~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp: In function ‘nvinfer1::ICudaEngine* createEngine(unsigned int, nvinfer1::IBuilder*, nvinfer1::IBuilderConfig*, nvinfer1::DataType)’:
/home/iic/tensorrtx/crnn/crnn.cpp:269:75: warning: ‘nvinfer1::ICudaEngine* nvinfer1::IBuilder::buildEngineWithConfig(nvinfer1::INetworkDefinition&, nvinfer1::IBuilderConfig&)’ is deprecated [-Wdeprecated-declarations]
     ICudaEngine* engine = builder->buildEngineWithConfig(*network, *config);
                                                                           ^
In file included from /home/iic/tensorrtx/crnn/crnn.cpp:5:0:
/usr/include/aarch64-linux-gnu/NvInfer.h:7990:43: note: declared here
     TRT_DEPRECATED nvinfer1::ICudaEngine* buildEngineWithConfig(
                                           ^~~~~~~~~~~~~~~~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp:273:22: warning: ‘void nvinfer1::INetworkDefinition::destroy()’ is deprecated [-Wdeprecated-declarations]
     network->destroy();
                      ^
In file included from /home/iic/tensorrtx/crnn/crnn.cpp:5:0:
/usr/include/aarch64-linux-gnu/NvInfer.h:5856:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp: In function ‘void APIToModel(unsigned int, nvinfer1::IHostMemory**)’:
/home/iic/tensorrtx/crnn/crnn.cpp:297:21: warning: ‘void nvinfer1::ICudaEngine::destroy()’ is deprecated [-Wdeprecated-declarations]
     engine->destroy();
                     ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/crnn/crnn.cpp:5:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:1434:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp:298:22: warning: ‘void nvinfer1::IBuilder::destroy()’ is deprecated [-Wdeprecated-declarations]
     builder->destroy();
                      ^
In file included from /home/iic/tensorrtx/crnn/crnn.cpp:5:0:
/usr/include/aarch64-linux-gnu/NvInfer.h:7929:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp: In function ‘int main(int, char**)’:
/home/iic/tensorrtx/crnn/crnn.cpp:318:24: error: variable ‘std::ofstream p’ has initializer but incomplete type
         std::ofstream p("crnn.engine", std::ios::binary);
                        ^
/home/iic/tensorrtx/crnn/crnn.cpp:324:30: warning: ‘void nvinfer1::IHostMemory::destroy()’ is deprecated [-Wdeprecated-declarations]
         modelStream->destroy();
                              ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/crnn/crnn.cpp:5:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:199:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp:327:27: error: variable ‘std::ifstream file’ has initializer but incomplete type
         std::ifstream file("crnn.engine", std::ios::binary);
                           ^
/home/iic/tensorrtx/crnn/crnn.cpp:376:28: error: ‘CV_BGR2GRAY’ was not declared in this scope
     cv::cvtColor(img, img, CV_BGR2GRAY);
                            ^~~~~~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp:404:22: warning: ‘void nvinfer1::IExecutionContext::destroy()’ is deprecated [-Wdeprecated-declarations]
     context->destroy();
                      ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/crnn/crnn.cpp:5:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:1888:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp:405:21: warning: ‘void nvinfer1::ICudaEngine::destroy()’ is deprecated [-Wdeprecated-declarations]
     engine->destroy();
                     ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/crnn/crnn.cpp:5:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:1434:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/crnn/crnn.cpp:406:22: warning: ‘void nvinfer1::IRuntime::destroy()’ is deprecated [-Wdeprecated-declarations]
     runtime->destroy();
                      ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/crnn/crnn.cpp:5:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:712:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
CMakeFiles/crnn.dir/build.make:62: recipe for target 'CMakeFiles/crnn.dir/crnn.cpp.o' failed
make[2]: *** [CMakeFiles/crnn.dir/crnn.cpp.o] Error 1
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/crnn.dir/all' failed
make[1]: *** [CMakeFiles/crnn.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
vampireacen commented 2 years ago

I use my environment to compile yolov5 and there is no error.

iic@iic-desktop:~/tensorrtx/yolov5$ mkdir aaa
iic@iic-desktop:~/tensorrtx/yolov5$ cd aaa/
iic@iic-desktop:~/tensorrtx/yolov5/aaa$ cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.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: /usr/local/cuda (found version "10.2")
-- Found OpenCV: /usr (found version "4.1.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/iic/tensorrtx/yolov5/aaa
iic@iic-desktop:~/tensorrtx/yolov5/aaa$ make
[ 16%] Building NVCC (Device) object CMakeFiles/myplugins.dir/myplugins_generated_yololayer.cu.o
/home/iic/tensorrtx/yolov5/yololayer.h(86): warning: function "nvinfer1::IPluginV2Ext::configurePlugin(const nvinfer1::Dims *, int32_t, const nvinfer1::Dims *, int32_t, const nvinfer1::DataType *, const nvinfer1::DataType *, const __nv_bool *, const __nv_bool *, nvinfer1::PluginFormat, int32_t)" is hidden by "nvinfer1::YoloLayerPlugin::configurePlugin" -- virtual function override intended?

/home/iic/tensorrtx/yolov5/yololayer.h(86): warning: function "nvinfer1::IPluginV2Ext::configurePlugin(const nvinfer1::Dims *, int32_t, const nvinfer1::Dims *, int32_t, const nvinfer1::DataType *, const nvinfer1::DataType *, const bool *, const bool *, nvinfer1::PluginFormat, int32_t)" is hidden by "nvinfer1::YoloLayerPlugin::configurePlugin" -- virtual function override intended?

Scanning dependencies of target myplugins
[ 33%] Linking CXX shared library libmyplugins.so
[ 33%] Built target myplugins
[ 50%] Building NVCC (Device) object CMakeFiles/yolov5.dir/yolov5_generated_preprocess.cu.o
/usr/include/opencv4/opencv2/stitching/detail/warpers.hpp(213): warning: overloaded virtual function "cv::detail::PlaneWarper::buildMaps" is only partially overridden in class "cv::detail::AffineWarper"

/usr/include/opencv4/opencv2/stitching/detail/warpers.hpp(213): warning: overloaded virtual function "cv::detail::PlaneWarper::warp" is only partially overridden in class "cv::detail::AffineWarper"

/usr/include/opencv4/opencv2/stitching/detail/blenders.hpp(100): warning: overloaded virtual function "cv::detail::Blender::prepare" is only partially overridden in class "cv::detail::FeatherBlender"

/usr/include/opencv4/opencv2/stitching/detail/blenders.hpp(127): warning: overloaded virtual function "cv::detail::Blender::prepare" is only partially overridden in class "cv::detail::MultiBandBlender"

/usr/include/opencv4/opencv2/stitching/detail/warpers.hpp(213): warning: overloaded virtual function "cv::detail::PlaneWarper::buildMaps" is only partially overridden in class "cv::detail::AffineWarper"

/usr/include/opencv4/opencv2/stitching/detail/warpers.hpp(213): warning: overloaded virtual function "cv::detail::PlaneWarper::warp" is only partially overridden in class "cv::detail::AffineWarper"

/usr/include/opencv4/opencv2/stitching/detail/blenders.hpp(100): warning: overloaded virtual function "cv::detail::Blender::prepare" is only partially overridden in class "cv::detail::FeatherBlender"

/usr/include/opencv4/opencv2/stitching/detail/blenders.hpp(127): warning: overloaded virtual function "cv::detail::Blender::prepare" is only partially overridden in class "cv::detail::MultiBandBlender"

Scanning dependencies of target yolov5
[ 66%] Building CXX object CMakeFiles/yolov5.dir/calibrator.cpp.o
[ 83%] Building CXX object CMakeFiles/yolov5.dir/yolov5.cpp.o
/home/iic/tensorrtx/yolov5/yolov5.cpp: In function ‘nvinfer1::ICudaEngine* build_engine(unsigned int, nvinfer1::IBuilder*, nvinfer1::IBuilderConfig*, nvinfer1::DataType, float&, float&, std::__cxx11::string&)’:
/home/iic/tensorrtx/yolov5/yolov5.cpp:112:75: warning: ‘nvinfer1::ICudaEngine* nvinfer1::IBuilder::buildEngineWithConfig(nvinfer1::INetworkDefinition&, nvinfer1::IBuilderConfig&)’ is deprecated [-Wdeprecated-declarations]
     ICudaEngine* engine = builder->buildEngineWithConfig(*network, *config);
                                                                           ^
In file included from /home/iic/tensorrtx/yolov5/common.hpp:9:0,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInfer.h:7990:43: note: declared here
     TRT_DEPRECATED nvinfer1::ICudaEngine* buildEngineWithConfig(
                                           ^~~~~~~~~~~~~~~~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp:116:22: warning: ‘void nvinfer1::INetworkDefinition::destroy()’ is deprecated [-Wdeprecated-declarations]
     network->destroy();
                      ^
In file included from /home/iic/tensorrtx/yolov5/common.hpp:9:0,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInfer.h:5856:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp: In function ‘nvinfer1::ICudaEngine* build_engine_p6(unsigned int, nvinfer1::IBuilder*, nvinfer1::IBuilderConfig*, nvinfer1::DataType, float&, float&, std::__cxx11::string&)’:
/home/iic/tensorrtx/yolov5/yolov5.cpp:216:75: warning: ‘nvinfer1::ICudaEngine* nvinfer1::IBuilder::buildEngineWithConfig(nvinfer1::INetworkDefinition&, nvinfer1::IBuilderConfig&)’ is deprecated [-Wdeprecated-declarations]
     ICudaEngine* engine = builder->buildEngineWithConfig(*network, *config);
                                                                           ^
In file included from /home/iic/tensorrtx/yolov5/common.hpp:9:0,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInfer.h:7990:43: note: declared here
     TRT_DEPRECATED nvinfer1::ICudaEngine* buildEngineWithConfig(
                                           ^~~~~~~~~~~~~~~~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp:220:22: warning: ‘void nvinfer1::INetworkDefinition::destroy()’ is deprecated [-Wdeprecated-declarations]
     network->destroy();
                      ^
In file included from /home/iic/tensorrtx/yolov5/common.hpp:9:0,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInfer.h:5856:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp: In function ‘void APIToModel(unsigned int, nvinfer1::IHostMemory**, bool&, float&, float&, std::__cxx11::string&)’:
/home/iic/tensorrtx/yolov5/yolov5.cpp:249:21: warning: ‘void nvinfer1::ICudaEngine::destroy()’ is deprecated [-Wdeprecated-declarations]
     engine->destroy();
                     ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/yolov5/common.hpp:9,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:1434:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp:250:22: warning: ‘void nvinfer1::IBuilder::destroy()’ is deprecated [-Wdeprecated-declarations]
     builder->destroy();
                      ^
In file included from /home/iic/tensorrtx/yolov5/common.hpp:9:0,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInfer.h:7929:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp:251:21: warning: ‘void nvinfer1::IBuilderConfig::destroy()’ is deprecated [-Wdeprecated-declarations]
     config->destroy();
                     ^
In file included from /home/iic/tensorrtx/yolov5/common.hpp:9:0,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInfer.h:7535:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp: In function ‘int main(int, char**)’:
/home/iic/tensorrtx/yolov5/yolov5.cpp:326:30: warning: ‘void nvinfer1::IHostMemory::destroy()’ is deprecated [-Wdeprecated-declarations]
         modelStream->destroy();
                              ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/yolov5/common.hpp:9,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:199:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp:431:22: warning: ‘void nvinfer1::IExecutionContext::destroy()’ is deprecated [-Wdeprecated-declarations]
     context->destroy();
                      ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/yolov5/common.hpp:9,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:1888:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp:432:21: warning: ‘void nvinfer1::ICudaEngine::destroy()’ is deprecated [-Wdeprecated-declarations]
     engine->destroy();
                     ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/yolov5/common.hpp:9,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:1434:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
/home/iic/tensorrtx/yolov5/yolov5.cpp:433:22: warning: ‘void nvinfer1::IRuntime::destroy()’ is deprecated [-Wdeprecated-declarations]
     runtime->destroy();
                      ^
In file included from /usr/include/aarch64-linux-gnu/NvInfer.h:54:0,
                 from /home/iic/tensorrtx/yolov5/common.hpp:9,
                 from /home/iic/tensorrtx/yolov5/yolov5.cpp:6:
/usr/include/aarch64-linux-gnu/NvInferRuntime.h:712:25: note: declared here
     TRT_DEPRECATED void destroy() noexcept
                         ^~~~~~~
[100%] Linking CXX executable yolov5
[100%] Built target yolov5
vampireacen commented 2 years ago

I need to use these two models in my project, but when I 'make' them after 'cmake ..', crnn reports an error but yolov5 is fine. Who can help me?

wang-xinyu commented 2 years ago

try tensorrt 7.x

vampireacen commented 2 years ago

try tensorrt 7.x

How to down tensorrt version to 7.x in jeston nano, I'm a beginner

wang-xinyu commented 2 years ago

@vampireacen That would need to re-flash a new jetpack. Or you can refer to yolov5, to migrate crnn from trt7 to trt8.

vampireacen commented 2 years ago

@vampireacen That would need to re-flash a new jetpack. Or you can refer to yolov5, to migrate crnn from trt7 to trt8.

Thanks a lot , I will try.

AlexBoooM commented 2 years ago

@vampireacen That would need to re-flash a new jetpack. Or you can refer to yolov5, to migrate crnn from trt7 to trt8.

Thanks a lot , I will try.

Did you solve the problem? I have the same error as yours.

AlexBoooM commented 2 years ago

@vampireacen That would need to re-flash a new jetpack. Or you can refer to yolov5, to migrate crnn from trt7 to trt8.

微信截图_20220110173944 I use trt7 but it doesnt work. What else can i try

wang-xinyu commented 2 years ago

@AlexBoooM your opencv seems not properly installed