Open zhujiandream opened 3 years ago
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.
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
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