syencil / tensorrt Goto Github PK
View Code? Open in Web Editor NEWTensorRT-7 Network Lib 包括常用目标检测、关键点检测、人脸检测、OCR等 可训练自己数据
TensorRT-7 Network Lib 包括常用目标检测、关键点检测、人脸检测、OCR等 可训练自己数据
Do you plan to support batch processing??
Hi,thank for your shareing. But i have some problems when I cmake in win10.
here is my cmakelist(only build retinaface):
cmake_minimum_required(VERSION 3.5)
project(tensorRT)
set_property(GLOBAL PROPERTY USE_FOLDERS on)
set(EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
message(STATUS "Project_binary_dir : ${PROJECT_BINARY_DIR}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(tensorrt_dir D:/c/TensorRT-7.0.0.11.Windows10.x86_64.cuda-10.0.cudnn7.6/TensorRT-7.0.0.11)
set(project_dir my/path/to/tensorRT-7)
include_directories(${tensorrt_dir}/include)
include_directories(${project_dir}/include)
link_directories(${tensorrt_dir}/lib)
link_directories(${project_dir}/source)
link_directories(${project_dir}/lib)
aux_source_directory(${common_dir}/source common_src)
set(COMMON_SRC ${common_src} CACHE INTERNAL "common_source" )
set(LOGGER_SRC ${common_dir}/source/logger.cpp CACHE INTERNAL "logger" )
message(STATUS "TensorRT Header => ${tensorrt_dir}/include")
message(STATUS "TensorRT Lib => ${tensorrt_dir}/lib")
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
if(NOT OpenCV_LIBRARY_DIRS)
set(OpenCV_LIBRARY_DIRS D:/software/opencv/build/x64/vc14/lib)
message(WARING " Can not find opencv lib. It will use the default path => ${OpenCV_LIBRARY_DIRS}")
endif()
link_directories(${OpenCV_LIBRARY_DIRS})
message(STATUS "OpenCV_INCLUDE_DIRS => ${OpenCV_INCLUDE_DIRS}")
message(STATUS "OpenCV_LIBRARY_DIRS => ${OpenCV_LIBRARY_DIRS}")
if(NOT OpenCV_FOUND)
message(ERROR "OpenCV not found!")
endif(NOT OpenCV_FOUND)
find_package(CUDA)
find_package(CUDA REQUIRED)
#include_directories(${CUDA_INCLUDE_DIRS})
include_directories(C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/include)
if(NOT CUDA_LIBRARY_DIRS)
set(CUDA_LIBRARY_DIRS C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.0/lib/x64)
message(WARING " Can not find CUDA lib. It will use the default path => ${CUDA_LIBRARY_DIRS}")
endif()
link_directories(${CUDA_LIBRARY_DIRS})
message(STATUS "CUDA_INCLUDE_DIRS : ${CUDA_INCLUDE_DIRS}")
message(STATUS "CUDA_LIBRARY_DIRS : ${CUDA_LIBRARY_DIRS}")
###############################################
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${project_dir}/lib)
set(TRT source/tensorrt.cpp source/logger.cpp source/utils.cpp source/utils.cu)
set(INT8 source/Int8Calibrator.cu source/Int8Calibrator.cpp)
set(RETINAFACE ${TRT} ${INT8} source/retinaface.cpp)
set(CV_LIB libopencv_core.so libopencv_imgproc.so libopencv_imgcodecs.so)
set(TRT_LIB libnvinfer.so libnvonnxparser.so cudart.so)
cuda_add_executable(retinaface retinaface_main.cpp)
target_link_libraries(retinaface retinafacetrt.so ${TRT_LIB} ${CV_LIB})
#########################3#####################
cuda_add_library(retinafacetrt SHARED ${RETINAFACE})
the "set(project_dir /work/tensorRT-7) ",what is means of the file :tensorRT-7? I can not generate this and find in gits file.
I can cmake/build successfully with compiler VNC14 and generate tensorRT.sln. BUT, it can not open retinaface.h when I debug the .sln, fatal error: no such file in retinaface.vcxproj.
and do not generate retinafaceInt8.calibration and retinafaceInt8.calibration.
so what should I do for compiling in win10?
hi,fcos.cpp的45行,
float tmp = sigmoid(cls_f[pos*length+c]) * cen_f[pos];
是不是应该写成
float tmp = sigmoid(cls_f[pos+length*c]) * cen_f[pos];
hi, could you please tell me how can I get CalibrationTablePath file and SerializedPath file?
Thanks, look forward for your reply
可以加个联系方式吗,xiong97531,wechat num
参考以下编译,报错。其中执行make + project_lib
或make + project_name
会报make: *** 没有规则可制作目标“+”。 停止。
错误。
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make + project_lib
make + project_name
./bin/project_name
如果直接make
报以下错误,请问如何解决或者对依赖库有版本要求
[ 28%] Linking CXX executable bin/stream
/usr/bin/ld: 找不到 -lnvinfer
/usr/bin/ld: 找不到 -lnvonnxparser
/usr/bin/ld: 找不到 -lnvinfer
/usr/bin/ld: 找不到 -lnvonnxparser
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/stream.dir/build.make:129:bin/stream] 错误 1
make[1]: *** [CMakeFiles/Makefile2:184:CMakeFiles/stream.dir/all] 错误 2
make: *** [Makefile:84:all] 错误 2
jetson Xavier NX,jetpack 4.5, cuda10.2,tensor rt 7.1.3
cmake之后直接make,报错:
[ 31%] Linking CXX executable bin/fcos
/usr/bin/ld: cannot find -lfcostrt
/usr/bin/ld: cannot find -llibnvinfer.so.7.1.3
/usr/bin/ld: cannot find -llibnvonnxparser.so.7.1.3
collect2: error: ld returned 1 exit status
CMakeFiles/fcos.dir/build.make:113: recipe for target 'bin/fcos' failed
make[2]: *** [bin/fcos] Error 1
CMakeFiles/Makefile2:215: recipe for target 'CMakeFiles/fcos.dir/all' failed
make[1]: *** [CMakeFiles/fcos.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
我将CMakeLists.txt中的第56行:
set(TRT_LIB libnvinfer.so.7.0.0 libnvonnxparser.so.7.0.0 cuda.so)
改为:
set(TRT_LIB /usr/lib/aarch64-linux-gnu/libnvinfer.so.7.1.3 /usr/lib/aarch64-linux-gnu/libnvonnxparser.so.7.1.3 cuda.so)
说明:我的libnvinfer.so文件在/usr/lib/aarch64-linux-gnu/位置,并且版本是7.1.3,并没有找到7.0.0,所以修改了版本和位置。
然后再make,报错:
[ 31%] Linking CXX executable bin/fcos
/usr/bin/ld: cannot find -lfcostrt
collect2: error: ld returned 1 exit status
CMakeFiles/fcos.dir/build.make:117: recipe for target 'bin/fcos' failed
make[2]: *** [bin/fcos] Error 1
CMakeFiles/Makefile2:215: recipe for target 'CMakeFiles/fcos.dir/all' failed
make[1]: *** [CMakeFiles/fcos.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
比之前少了两行,但还是没有生成libfcostrt.so这个文件。
如题
主要存在两个问题,求解答:
1、在问题#11中,对于yolov5s转换完的模型出现检测出来的目标少于python的问题,您指出是预处理方式的问题,请问具体如何修改?是否有尝试结果?
2、在运行转换好的trt模型时,出现如下的报错
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:220: Your ONNX model has been generated with INT64 weights, while TensorRT does not natively support INT64. Attempting to cast down to INT32.
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:13] [W] [TRT] onnx2trt_utils.cpp:246: One or more weights outside the range of INT32 was clamped
[11/18/2020-14:24:17] [I] [TRT] Some tactics do not have sufficient workspace memory to run. Increasing workspace size may increase performance, please check verbose output.
这个能够有比较简单的方法解决吗?还是需要去原始模型代码中转换相关部分的数据类型?
大佬,我自己尝试将U版的yolov3转onnx转tensorRT,但是测到的速度在pytorch原版上是推理20ms一张图而在tensorRT推理也是差不多这个速度。请问要如何加速呀?转int8吗?
Hi there! Thank you for your excellent codes and it helps me a lot. I trained a network with pytorch and deployed it with tensorRT successfully. But the infer time (do NOT include pre/post process) got longer compared to inferring in torch. While converted to INT8 the model is getting faster but not enough. Is that normal? Maybe there is something I missed while deploying the model. I have no idea about it and can you hint me with any ideas?
GPU: GTX1080Ti/CUDA10.0
Model: DeeplabV3Plus with backbone ResNet50
pytorch1.6 infer time 15ms
tensorrt infer time 22ms/FP32, 13ms/INT8
大佬,我想问一下,就是数据预处理那,cv2直接读图是BGR格式,但是原工程训练时候用的是RGB格式,不转成RGB没有问题吗?
您好,fp32测试是正常出框的,int8量化后不出框是怎么回事?
tensorrt是deb安装的么?谢谢
大佬,请问Psenet转trt的代码方便提供一份不?
如题,谢谢!
tensorRT6.0 尝试有问题,编译加载pytorch的onnx,会有问题
[ 20%] Linking CXX executable bin/yolo5
/usr/bin/ld: 找不到 -lyolo5trt
这个报错找不到yolo5trt库是什么原因?
cmakelist.txt里面还有哪些要改
@Syencil Hi there,
i have a task dealing with text detection.
are you available for freelancing?
if so contact me by my email so i can share with you more information.
[email protected]
in make:
not found yolov5trt
大佬好,感谢大佬的工作
我是从您那个轻量化 yolov5s 来的,用的也是您那个 yolov5s_voc 的代码,放到这个工程里面,都是可以成功运行的,但是最后预测完图片上啥也没有,打印了一下 bboxs 大小也是 0
求教大佬这个该如何解决
再次感谢!
ONNX IR version: 0.0.6
Opset version: 11
Producer name: pytorch
Producer version: 1.5
Domain:
Model version: 0
While parsing node number 108 [Resize]:
ERROR: ModelImporter.cpp:124 In function parseGraph:
[5] Assertion failed: ctx->tensors().count(inputName)
[08/12/2020-10:45:42] [E] Parsing File Failed
[08/12/2020-10:45:42] [E] Init Session Failed!
Segmentation fault (core dumped)
I have check the print export_onnx_model. no %108.
if I choose Opset version=12, the print of export_onnx_model.:%108:Long()
but,the same error counted
Hey @Syencil .
First of all thank you for the awesome code samples.
RetinaFace sample works well on TensorRT 7.1.3 with Cuda 11 but fails with no detection on Jetson Nano (TRT 7.1.3 & Cuda 10.2).
Can you help me in this regard?
hi there,
when I do the cmake . step, error pops up like:
CMake Error at /opt/cmake-3.12.2-Linux-x86_64/share/cmake-3.12/Modules/FindCUDA.cmake:1816 (add_library):
Cannot find source file:
source/ctpn.cpp
please help, thanks!
hello,I follow the Quick Start,and get yolov5s.onnx from https://github.com/Syencil/mobile-yolov5-pruning-distillation, when run the ./bin/yolov5 raise the error "Found unsupported datatype (11) when importing initializer: model.0.conv.total_ops". I check the onnx export log, "DOUBLE" datatype exists, may be this lead to error, how can i solve this, any help will be appreciated.
I use the pytorch1.4 and TensorRT7.1.3.4.
作者你好,我有一个问题,是关于把pse算法的onnx模型转换到pb模型,遇到的一个问题:
**Traceback (most recent call last):
File "/home/fffan/fffan_files/Experiment/Example/onnx2pb/onnx2pb.py", line 45, in
onnx2pb_2(onnx_input_path)
File "/home/fffan/fffan_files/Experiment/Example/onnx2pb/onnx2pb.py", line 14, in onnx2pb_2
tf_rep = prepare(model)
File "/home/fffan/下载/onnx-tensorflow-tf-1.x/onnx_tf/backend.py", line 65, in prepare
return cls.onnx_model_to_tensorflow_rep(model, strict)
File "/home/fffan/下载/onnx-tensorflow-tf-1.x/onnx_tf/backend.py", line 85, in onnx_model_to_tensorflow_rep
return cls._onnx_graph_to_tensorflow_rep(model.graph, opset_import, strict)
File "/home/fffan/下载/onnx-tensorflow-tf-1.x/onnx_tf/backend.py", line 146, in _onnx_graph_to_tensorflow_rep
strict=strict)
File "/home/fffan/下载/onnx-tensorflow-tf-1.x/onnx_tf/backend.py", line 241, in _onnx_node_to_tensorflow_op
return handler.handle(node, tensor_dict=tensor_dict, strict=strict)
File "/home/fffan/下载/onnx-tensorflow-tf-1.x/onnx_tf/handlers/handler.py", line 60, in handle
cls.args_check(node, kwargs)
File "/home/fffan/下载/onnx-tensorflow-tf-1.x/onnx_tf/handlers/backend/resize.py", line 89, in args_check
"Tensorflow")
File "/home/fffan/下载/onnx-tensorflow-tf-1.x/onnx_tf/common/exception.py", line 50, in call
raise self._func(self.get_message(op, framework))
RuntimeError: Resize coordinate_transformation_mode=pytorch_half_pixel is not supported in Tensorflow.
我没看到载pytorch有关pytorch_half_pixel这个的使用,但是转换模型的时候总是这个错。请问作者能不能解决这个问题?
非常期待作者的回复。
你好,请问你将mmdetection中Retinanet的模型转换为onnx是使用mmdetection提供的工具转换的吗?
作者你好,对于TRT不支持的层是如何处理的呢? 比如Unsample层? 期待回复
运行yolov5代码,报错
double free or corruption (out)
通过删减代码,执行前处理和推理过程后会报此类错误,重复释放内存问题
还是说只能对yolov5x.pt进行加速?
在tf2中如何将yolov3转换为冻结图,并生成对应的.pb文件?
The problem is that I can not parse the yolov5 model
the error is
While parsing node number 176 [Resize]:
ERROR: ModelImporter.cpp:124 In function parseGraph:
[5] Assertion failed: ctx->tensors().count(inputName)
[07/28/2021-11:07:41] [E] Parsing File Failed
[07/28/2021-11:07:41] [E] Init Session Failed!
Segmentation fault
My environment
Tensorrt 7.0
cuda 10.2
opencv 3.4
I hope I can get some help, thanks !
这样可以跑一跑代码
你好! psenetv2 里面 trtParams.CalibrationTablePath和trtParams.SerializedPath这两个参数是怎么定的
for (auto &future : futures) {
future = mThreadPool.submit(&Yolov5::postProcessParall, this, block_start, block_size, height, width, scale_idx, postThres, origin_output, &bboxes);
block_start += block_size;
}
this->postProcessParall(block_start, height-block_start, height, width, scale_idx, postThres, origin_output, &bboxes);
for (auto &future : futures){
future.get();
}
请问
this->postProcessParall(block_start, height-block_start, height, width, scale_idx, postThres, origin_output, &bboxes);
这一步是有什么用吗?
这一步之前提交多线程操作
这一步之后运行多线程操作
这一步没看懂有什么用
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.