diff --git a/configs/mmdet/instance-seg/instance-seg_tensorrt_dynamic-320x320-1344x1344.py b/configs/mmdet/instance-seg/instance-seg_tensorrt_dynamic-320x320-1344x1344.py index 9d4d055902..ac17b1e299 100644 --- a/configs/mmdet/instance-seg/instance-seg_tensorrt_dynamic-320x320-1344x1344.py +++ b/configs/mmdet/instance-seg/instance-seg_tensorrt_dynamic-320x320-1344x1344.py @@ -4,7 +4,7 @@ ] backend_config = dict( - common_config=dict(max_workspace_size=1 << 30), + common_config=dict(max_workspace_size=1 << 32), model_inputs=[ dict( input_shapes=dict( diff --git a/mmdeploy/codebase/mmdet/models/dense_heads/__init__.py b/mmdeploy/codebase/mmdet/models/dense_heads/__init__.py index b783f98a5f..062bc7de52 100644 --- a/mmdeploy/codebase/mmdet/models/dense_heads/__init__.py +++ b/mmdeploy/codebase/mmdet/models/dense_heads/__init__.py @@ -1,6 +1,7 @@ # Copyright (c) OpenMMLab. All rights reserved. from . import base_dense_head # noqa: F401,F403 from . import centernet_head # noqa: F401,F403 +from . import condinst_head # noqa: F401,F403 from . import detr_head # noqa: F401,F403 from . import fovea_head # noqa: F401,F403 from . import gfl_head # noqa: F401,F403 @@ -12,4 +13,3 @@ from . import solov2_head # noqa: F401,F403 from . import yolo_head # noqa: F401,F403 from . import yolox_head # noqa: F401,F403 -from . import condinst_head # noqa: F401,F403 diff --git a/mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py b/mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py index c2ef0423e8..85f9ca76cf 100644 --- a/mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py +++ b/mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py @@ -137,8 +137,8 @@ def condinst_mask_head__forward(self, x: tuple, weights, biases = _parse_dynamic_params(self, param_preds) mask_preds = _dynamic_conv_forward(mask_head_inputs, weights, biases) mask_preds = mask_preds.reshape(batch_size, num_insts, hw[0], hw[1]) - mask_preds = aligned_bilinear(mask_preds, - int(self.mask_feat_stride / self.mask_out_stride)) + mask_preds = aligned_bilinear( + mask_preds, int(self.mask_feat_stride / self.mask_out_stride)) return (mask_preds, ) diff --git a/mmdeploy/pytorch/functions/repeat.py b/mmdeploy/pytorch/functions/repeat.py index b1b768ef4b..b3a5e09b68 100644 --- a/mmdeploy/pytorch/functions/repeat.py +++ b/mmdeploy/pytorch/functions/repeat.py @@ -20,7 +20,8 @@ def tensor__repeat__tensorrt(input: torch.Tensor, *size: Union[torch.Size, origin_func = ctx.origin_func if input.dim() == 1 and len(size) == 1: if isinstance(*size, tuple): - return origin_func(input.unsqueeze(0), *([1] + list(*size))).squeeze(0) + return origin_func(input.unsqueeze(0), + *([1] + list(*size))).squeeze(0) return origin_func(input.unsqueeze(0), *([1] + list(size))).squeeze(0) else: return origin_func(input, *size) diff --git a/tests/test_codebase/test_mmdet/test_mmdet_models.py b/tests/test_codebase/test_mmdet/test_mmdet_models.py index e8f19b2535..9f14a555e8 100644 --- a/tests/test_codebase/test_mmdet/test_mmdet_models.py +++ b/tests/test_codebase/test_mmdet/test_mmdet_models.py @@ -2487,7 +2487,7 @@ def test_condinst_bbox_head_predict_by_feat(backend_type): wrapped_model=wrapped_model, model_inputs=rewrite_inputs, deploy_cfg=deploy_cfg) - + if is_backend_output: dets = rewrite_outputs[0] labels = rewrite_outputs[1] @@ -2571,18 +2571,18 @@ def test_condinst_mask_head_predict_by_feat(backend_type): max_shape=[1, 3, 1344, 1344]))) ]), onnx_config=dict(output_names=output_names, input_shape=None), - codebase_config=dict( - type='mmdet', - task='ObjectDetection'))) - + codebase_config=dict(type='mmdet', task='ObjectDetection'))) + class TestCondInstMaskHeadModel(torch.nn.Module): + def __init__(self, condinst_mask_head): super(TestCondInstMaskHeadModel, self).__init__() self.mask_head = condinst_mask_head def predict_by_feat(self, mask_preds, det, label, batch_img_metas): results = dict(dets=det, labels=label) - return self.mask_head.predict_by_feat(mask_preds, results, batch_img_metas) + return self.mask_head.predict_by_feat(mask_preds, results, + batch_img_metas) head = get_condinst_mask_head() condinst_mask_head = TestCondInstMaskHeadModel(head) @@ -2597,11 +2597,7 @@ def predict_by_feat(self, mask_preds, det, label, batch_img_metas): # to get outputs of onnx/tensorrt model after rewrite wrapped_model = WrapModel( condinst_mask_head, 'predict_by_feat', batch_img_metas=batch_img_metas) - rewrite_inputs = { - 'mask_preds': mask_preds, - 'det': dets, - 'label': labels - } + rewrite_inputs = {'mask_preds': mask_preds, 'det': dets, 'label': labels} rewrite_outputs, is_backend_output = get_rewrite_outputs( wrapped_model=wrapped_model, model_inputs=rewrite_inputs,