grimoire / mmdetection-to-tensorrt

convert mmdetection model to tensorrt, support fp16, int8, batch input, dynamic shape etc.
Apache License 2.0
585 stars 85 forks source link

the question about interpolate #25

Open MyDecember12 opened 3 years ago

MyDecember12 commented 3 years ago

hey,when the tensor is interpolated in the fpn layer, the output value has changed, which is different from the original mmdetection output value, so this makes the output of the entire network deviate,The problem maybe happen in torch2trt_dynamic/torch2trt_dynamic/converters/interpolate_custom.py ,Is there any solution for this?

grimoire commented 3 years ago

Hi The interpolate layer in TRT is IResizeLayer, Which only have interpolate mode (NEAREST, LINEAR). pytorch have 5 different interpolate mode(nearest, linear (3D-only), bilinear, bicubic (4D-only), trilinear (5D-only)). And the nearest implementations of these two frameworks are slightly different. TRT might have optimize on IResizeLayer, and It is hard to implement a plugin of interp layer with perfect dynamic shape support. That's why I choice IResizeLayer. You can write your custom interplate plugin if you really need.