grimoire/mmdetection-to-tensorrt

test.py

Closed this issue · 4 comments

Thanks for your helpful work.

I have a problem when I tested trt_model in a dateset.

I found that using tool/test.py to test the COCO2017 dataset causes problems, and I think it's because of an error related to mmdection 'single_gpu_test' and the result from 'ModelWarper'.

The result of the error is.
400000/5000, 1053.8 task/s, elapsed: 380s, ETA: -374s

It should be stopped at 5000 not 400000. Could you please help me with this problem?

The trt_model I am using is transferred from mmdetection 'faster_rcnn_r50_fpn_1x_coco_20200130-047c8118.pth'.

Hi
Thanks for your bug report. This test module is created before mmdetection 2.3.0, They must have change something after that.
Change the return value of ModelWarp.forward() to return convert_to_mmdet_result(result, self.num_classes) (remove [0]) should give you the right result.

Thanks for your reply.

This might work, but there's an error:

[TensorRT] ERROR: Parameter check failed at: engine.cpp::setBindingDimensions::1046, condition: profileMinDims.d[i] <= dimensions.d[i]

That's caused by small opt_shape_param range.
some images might have large w/h ratio after preprocess. set opt_shape_param like below should fix this:

    opt_shape_param=[
        [
            [1,3,224,224],    # min tensor shape
            [1,3,800,1312],  # shape used to do int8 calib
            [1,3,1344,1344], # max tensor shape
        ]
    ]

Worth to mention that, large opt_shape_param need more memory.

Thanks, the problem is solved.