mmdeploy icon indicating copy to clipboard operation
mmdeploy copied to clipboard

[Fix] fix det with static shape

Open grimoire opened this issue 1 year ago • 3 comments

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

static shape config failed when pad mode is size instead of size_divisor

Modification

configs/efficientnet/retinanet_effb3_fpn_crop896_8x4_1x_coco.py

onnx_config = dict(
    type='onnx',
    export_params=True,
    keep_initializers_as_inputs=False,
    opset_version=11,
    save_file='end2end.onnx',
    input_names=['input'],
    output_names=['dets', 'labels'],
    input_shape=(896, 896),
    # dynamic_axes=dict(
    #     input=dict({
    #         0: 'batch',
    #         2: 'height',
    #         3: 'width'
    #     }),
    #     dets=dict({
    #         0: 'batch',
    #         1: 'num_dets'
    #     }),
    #     labels=dict({
    #         0: 'batch',
    #         1: 'num_dets'
    #     })),
    optimize=True)
codebase_config = dict(
    type='mmdet',
    task='ObjectDetection',
    model_type='end2end',
    post_processing=dict(
        score_threshold=0.05,
        confidence_threshold=0.005,
        iou_threshold=0.5,
        max_output_boxes_per_class=200,
        pre_top_k=5000,
        keep_top_k=100,
        background_label_id=-1))
backend_config = dict(
    type='tensorrt',
    common_config=dict(fp16_mode=False, max_workspace_size=1073741824),
    model_inputs=[
        dict(
            input_shapes=dict(
                input=dict(
                    min_shape=[1, 3, 896, 896],
                    opt_shape=[1, 3, 896, 896],
                    max_shape=[1, 3, 896, 896])))
    ])

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories? If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

grimoire avatar Sep 15 '22 04:09 grimoire

Seems the case also appeared in rotated detection.

AllentDan avatar Sep 16 '22 02:09 AllentDan

@AllentDan it there a model config to test?

grimoire avatar Sep 16 '22 05:09 grimoire

I just searched == 'Pad' and found line 67 of mmdeploy/codebase/mmrotate/deploy/rotated_detection.py. But I don't know if there is a model config to trigger the error.

AllentDan avatar Sep 16 '22 05:09 AllentDan