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

In mmdetection,applying DCNv2 in the Res2Net code will cause errors, while DCN will not? #30

Closed
Taylor-X76 opened this issue Apr 17, 2020 · 5 comments

Comments

@Taylor-X76
Copy link

File "/data/xmy/mmdet_new/mmdetection/mmdet/models/backbones/res2net.py", line 211, in forward
out = _inner_forward(x)
File "/data/xmy/mmdet_new/mmdetection/mmdet/models/backbones/res2net.py", line 181, in _inner_forward
main() sp = self.convsi
File "/home/l547/anaconda3/envs/MMDET_xmy1/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in call

File "./tools/train.py", line 138, in main
meta=meta)
File "/data/xmy/mmdet_new/mmdetection/mmdet/apis/train.py", line 102, in train_detector
result = self.forward(*input, **kwargs)
File "/data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv.py", line 403, in forward
meta=meta)
File "/data/xmy/mmdet_new/mmdetection/mmdet/apis/train.py", line 177, in _dist_train
self.groups, self.deformable_groups)
File "/data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv.py", line 148, in forward
ctx.groups, ctx.deformable_groups, ctx.with_bias)

RuntimeErrorrunner.run(data_loaders, cfg.workflow, cfg.total_epochs): 

input tensor has to be contiguous (modulated_deform_conv_cuda_forward at mmdet/ops/dcn/src/deform_conv_cuda.cpp:497)
frame #0: c10::Error::Error(c10::SourceLocation, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x6d (0x7ff852af333d in /home/l547/anaconda3/envs/MMDET_xmy1/lib/python3.7/site-packages/torch/lib/libc10.so)
frame #1: modulated_deform_conv_cuda_forward(at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor, int, int, int, int, int, int, int, int, int, int, bool) + 0x1285 (0x7ff81a84ceb5 in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #2: + 0x26fed (0x7ff81a85cfed in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #3: + 0x2722e (0x7ff81a85d22e in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so)
frame #4: + 0x22f9c (0x7ff81a858f9c in /data/xmy/mmdet_new/mmdetection/mmdet/ops/dcn/deform_conv_cuda.cpython-37m-x86_64-linux-gnu.so)
.......

@gasvn
Copy link
Member

gasvn commented Apr 17, 2020

Add contiguous() in line 180 of file: https://github.com/Res2Net/mmdetection/blob/master/mmdet/models/backbones/res2net.py

will solve this problem.

image

@Taylor-X76
Copy link
Author

Add contiguous() in line 180 of file: https://github.com/Res2Net/mmdetection/blob/master/mmdet/models/backbones/res2net.py

will solve this problem.

image

Thank you very much for taking the time to answer my questions,the issue has been solved.

@Taylor-X76
Copy link
Author

Taylor-X76 commented Apr 17, 2020 via email

@panjianning
Copy link

I got 47.6 mAP on val2017 with cascade_rcnn_res2net101_dcnv2_fpn_1x.

@Pluto1314
Copy link

@panjianning 你好,请问下如何添加dcn到res2net中呢,我直接在backbone中添加配置好像不行,报错:AttributeError: 'Bottle2neck' object has no attribute 'conv2'。

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

4 participants