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

Max_error in Interpolate Plugin #10

Open
zhujiandream opened this issue Nov 12, 2020 · 2 comments
Open

Max_error in Interpolate Plugin #10

zhujiandream opened this issue Nov 12, 2020 · 2 comments

Comments

@zhujiandream
Copy link

Dear my friend,

I found result difference in FPN output which leads to total MMDETECTION model convert result difference. The MAP lower 4%

So I test the Interpolate Converter with "python3 -m torch2trt_dynamic.test --name=interpolate" command

(1) when I change the test code in interpolate_custom.py as :

@add_module_test(torch.float32, torch.device('cuda'), [(1, 256, 13, 19)])
def test_interpolate_size_4d_nearest():
return InterpolateTest( (25,37), mode='nearest')

the max error is 0

(2) when I change the test code in interpolate_custom.py as :

@add_module_test(torch.float32, torch.device('cuda'), [(1, 256, 25, 37)])
def test_interpolate_size_4d_nearest():
return InterpolateTest( (50,74), mode='nearest')

the max error is tensor(6.6876, device='cuda:0')

Pls kindly help to fix this convert error

@grimoire
Copy link
Owner

Hi
Thanks for the bug report.
The interpolate layer is implemented by IResizeLayer in TRT. I did found there are some different between pytorch and TRT in NEAREST mode. There is one pixel offset on some scales.
I have create a thread on nvidia forums, hope they can answer this question.

And, could you tell me what model are you using? The MAP loss should be less than 1% on most model on coco dataset(even with the interpolate problem). Let me see if I can do something.

@zhujiandream
Copy link
Author

I converted the faster_rcnn model (faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth) from
https://github.com/open-mmlab/mmdetection/tree/master/configs/faster_rcnn

Interpolate plugin is used in FPN neck of the model

Acoording to my test, if the score of bbox in mmdetection 0.9812, the score in tensorrt is 0.9808, very small difference.
If the score of mmdetection is 0.72, which just a little higher than the threshold 0.7, the score in tensorrt would change to 0.62. Then it leads to the drop of MAP performance

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

2 participants