Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rcnn on windows #913

Closed
sctrueew opened this issue Feb 16, 2022 · 38 comments
Closed

rcnn on windows #913

sctrueew opened this issue Feb 16, 2022 · 38 comments

Comments

@sctrueew
Copy link

Hi,

I have a problem with the building of rcnn (detectron2) on Windows. I get an error:
Error LNK1181 cannot open input file 'Release\myplugins.lib' rcnn \tensorrtx\rcnn\b\LINK 1
Myplugins.lib isn't in the path, but it built successfully

OpenCV: 4.5.4
TensorRT: TensorRT-7.2.3.4
CUDA: 11.2

@rgkannan676
Copy link
Contributor

@sctrueew , Hi any update on this issue? I am also facing same issue.

LNK1181 cannot open input file 'Release\myplugins.lib' rcnn
LNK1181 cannot open input file 'C:\Users\tensorrtx\rcnn\build\CMakeFiles\myplugins.dir\Release\myplugins_generated_BatchedNms.cu.obj' myplugins

Thanks

@rgkannan676
Copy link
Contributor

@freedenS . Hi can you please tell what are the steps to make and build RCNN in windows. I am trying to make using Cmake and build using visual studio 2019.

@rgkannan676
Copy link
Contributor

rgkannan676 commented Mar 10, 2022

I made the changes - #521 (comment) for cuda 11.1.

@rgkannan676
Copy link
Contributor

Hi, Seems like most of the issues are associated with C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\cub\device\dispatch\dispatch_radix_sort.cuh . Some of the issues are as below.

E0276	name followed by '::' must be a class or namespace name	myplugins	C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\cub\device\dispatch\dispatch_radix_sort.cuh	410	
E0020	identifier "RADIX_RANK_MATCH" is undefined	myplugins	C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\cub\device\dispatch\dispatch_radix_sort.cuh	701	

Do I need to add any additional libraries? Please advise.

@rgkannan676
Copy link
Contributor

E0864 DeviceRadixSortPolicy is not a template myplugins C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include\cub\device\dispatch\dispatch_radix_sort.cuh 824

@sctrueew
Copy link
Author

@rgkannan676 Hi,

I couldn't build it. I got this error
invalid numeric argument '/Wfatal-errors'

TensorRt: 7.2
Cuda: 10.2
Os: Win 10

@rgkannan676
Copy link
Contributor

Hi @freedenS , Is it possible to build in windows? Can you please confirm? Thank you.

@freedenS
Copy link
Contributor

freedenS commented Mar 11, 2022

to build rcnn in windows:

  1. open a project with cuda in vs
  2. add rcnn .h .hpp .cpp .cu
  3. set trt/opencv include and directory
  4. add "--extended-lambda" in CUDA C/C++ -> Command Line -> Other options
  5. replace linux function in dirent.h with corresponding win function

@freedenS
Copy link
Contributor

@rgkannan676 Hi,

I couldn't build it. I got this error invalid numeric argument '/Wfatal-errors'

TensorRt: 7.2 Cuda: 10.2 Os: Win 10

if you use cuda 10.2, you should assure it is updated. NVIDIA/TensorRT#1151

@rgkannan676
Copy link
Contributor

to build rcnn in windows:

  1. open a project with cuda in vs
  2. add rcnn .h .hpp .cpp .cu
  3. set trt/opencv include and directory
  4. add "--extended-lambda" in CUDA C/C++ -> Command Line -> Other options
  5. replace linux function in dirent.h with corresponding win function

Hi @freedenS , Thank you for the reply. This resolved my issues and was able to build the .exe file.

@sctrueew
Copy link
Author

@rgkannan676 Hi,

I created a empty project and all .hpp .cpp .cu

  1. TensorRT-7.2.3.4.Windows10.x86_64.cuda-11.0.cudnn8.1
  2. opencv_4_5_4_cuda_11_2
  3. CUDA v11.2
  4. VS 2019

I added --extended-lambda to the Additional options but I get this errors
image

Could you please some help?

@rgkannan676
Copy link
Contributor

Try to add the libraries.

Linker -> All Options -> Additional Dependencies. Add the following libraries.

cudart_static.lib
nvinfer.lib
cudart.lib
nvinfer_plugin.lib
cudadevrt.lib
cublas.lib
cublasLt.lib

@rgkannan676
Copy link
Contributor

Have you converted .cu files Item Type as "CUDA C/C++" ? You can see this option in the "Properties" of the files.

@rgkannan676
Copy link
Contributor

Also have you added CUDA 11.2 as dependency? Build Dependencies -> Build Customizations and select CUDA 11.2

@rgkannan676
Copy link
Contributor

once you add CUDA 11.2 dependency, "--extended-lambda " need to be added to CUDA C/C++ -> Command Line -> Additional Options.

@sctrueew
Copy link
Author

sctrueew commented Mar 11, 2022

I set
image

image

and have

opencv_world454.lib
nvinfer.lib
cudart.lib
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\lib\x64\cudart.lib
kernel32.lib
user32.lib
gdi32.lib
winspool.lib
shell32.lib
ole32.lib
oleaut32.lib
uuid.lib
comdlg32.lib
advapi32.lib
cudart_static.lib
nvinfer_plugin.lib
cudadevrt.lib
cublas.lib
cublasLt.lib

but it wan't solved

@sctrueew
Copy link
Author

@rgkannan676 Have you any idea?

@rgkannan676
Copy link
Contributor

Have you set

  • C/C++ -> All Options -> Additional Include Directories with following ? (Change path according to your env). You can add the tensorRT include path also. I am not adding since I copied it to CUDA folder.

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include
C:\OpenCV\include

  • Linker -> All Options -> Additional Library directories. Add following. You can add your tensorRT lib path also.
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\lib\x64
  • Build the project in Release configuration.

image

@sctrueew
Copy link
Author

Yes exactly, I set
image

and

image

image

also I have changed #521 (comment)

@rgkannan676
Copy link
Contributor

rgkannan676 commented Mar 11, 2022

above are the changes I made. One more thing, Have you checked 'CUDA_PATH' in Environment Variables? Is it pointing to 11.2? If not, set it to 11.2 and restart.

@sctrueew
Copy link
Author

above are the changes I made. One more thing, Have you checked 'CUDA_PATH' in Environment Variables? Is it pointing to 11.2? If not, set it to 11.2 and restart.

I've set everything up, but I don't know what the problem is?
Could you please share your project or send it to me?

@sctrueew
Copy link
Author

@rgkannan676
With the configs, I almost built all the projects in this repo except rcnn. Can you tell me what's wrong?

@freedenS
Copy link
Contributor

could you show your compiling log?

@sctrueew
Copy link
Author

sctrueew commented Mar 11, 2022

could you show your compiling log?

@freedenS Hi,

image
log.txt

@sctrueew
Copy link
Author

sctrueew commented Mar 11, 2022

could you show your compiling log?

@freedenS Hi,

image

I've added the log.

@rgkannan676
Copy link
Contributor

Hi @sctrueew , Sorry, not able to share project due to privacy issue. One more check, have you set the Item Type property?

image

@sctrueew
Copy link
Author

Hi @sctrueew , Sorry, not able to share project due to privacy issue. One more check, have you set the Item Type property?

image

No problem, yes I checked again and the Item type was set for all *.cu files
image

@freedenS
Copy link
Contributor

1>D:\Projects\yolov5\tensorrtx\rcnn\MaskRcnnInferencePlugin.h(37): error : expected a ";"
it seems like you are not same with master

@sctrueew
Copy link
Author

sctrueew commented Mar 11, 2022

1>D:\Projects\yolov5\tensorrtx\rcnn\MaskRcnnInferencePlugin.h(37): error : expected a ";" it seems like you are not same with master

I've cloned again and built it.

@rgkannan676
Copy link
Contributor

FYI, I created a new solution -> new project-> copied all .cpp, .h, .cu files in the git repo to new project folder and added it to project. Replaced the contents in the main function with rcnn.cpp, along with the changes mentioned above.

@sctrueew
Copy link
Author

FYI, I created a new solution -> new project-> copied all .cpp, .h, .cu files in the git repo to new project folder and added it to project. Replaced the contents in the main function with rcnn.cpp, along with the changes mentioned above.

Once again, I followed the steps step by step.

image

@freedenS
Copy link
Contributor

you'd better use trt7, such as 7.2.1 described in README, it looks like trt8 has changed that api. i'm not sure.

@sctrueew
Copy link
Author

@freedenS @rgkannan676 Thank you for the tips, finally, I've built it with Tr 7.2.3

@sctrueew
Copy link
Author

@freedenS Hi,

I've trained a model with mask_rcnn_R_50_FPN_3x and convert the .pth to .wts. I have 1 class and I changed NUM_CLASSES = 1 in gen_wts.py. I could generate the faster.wts successfully, I change in rcnn side lines:

  1. NUM_CLASSES = 1
  2. BACKBONE_RESNETTYPE R50
  3. STRIDE_IN_1X1 true

but I'm facing this error when I run rcnn -s faster.wts faster.engine m:

Loading weights: faster.wts [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 Building engine, please wait for a while... [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: kernel weights has count 0 but 9408 was expected [03/11/2022-18:22:33] [E] [TRT] (Unnamed Layer* 6) [Convolution]: count of 0 weights in kernel, but kernel dimensions (7,7) with 3 input channels, 64 output channels and 1 groups were specified. Expected Weights count is 3 * 7*7 * 64 / 1 = 9408 [03/11/2022-18:22:33] [E] [TRT] Could not compute dimensions for (Unnamed Layer* 6) [Convolution]_output, because the network is not valid. [03/11/2022-18:22:33] [E] [TRT] Network validation failed. Build engine successfully!

@freedenS
Copy link
Contributor

freedenS commented Mar 12, 2022

what's the size of faster.wts?
it shows the weight value has not loaded correctly

@sctrueew
Copy link
Author

what's the size of faster.wts? it shows the weight value has not loaded correctly

faster.wts size is ~390 mb

I'm using mask_rcnn_R_50_FPN_3x. Does it support FPN? or I should use C4?

@freedenS
Copy link
Contributor

what's the size of faster.wts? it shows the weight value has not loaded correctly

faster.wts size is ~390 mb

I'm using mask_rcnn_R_50_FPN_3x. Does it support FPN? or I should use C4?

it doesn't support FPN, you can only use C4

@rgkannan676
Copy link
Contributor

rgkannan676 commented Mar 15, 2022

Hi @freedenS , One more doubt, can you please tell how to change the image height and width . I have an image of shape 600x875. And I change the IMAGE_HEIGHT, IMAGE_WIDTH accordingly. But still the output is of dimension INPUT_H = 480x INPUT_W = 640;

Can you please suggest what need to be changed? I tried changing INPUT_H and INPUT_W but it doesn't give any bbox detections. Can you please advise. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants