Skip to content

Commit

Permalink
fix lint error
Browse files Browse the repository at this point in the history
  • Loading branch information
Boomerl committed Oct 8, 2023
1 parent fbac65e commit 520dcd6
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion mmdeploy/codebase/mmdet/models/dense_heads/__init__.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
4 changes: 2 additions & 2 deletions mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(

Check warning on line 140 in mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py

View check run for this annotation

Codecov / codecov/patch

mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py#L137-L140

Added lines #L137 - L140 were not covered by tests
mask_preds, int(self.mask_feat_stride / self.mask_out_stride))
return (mask_preds, )

Check warning on line 142 in mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py

View check run for this annotation

Codecov / codecov/patch

mmdeploy/codebase/mmdet/models/dense_heads/condinst_head.py#L142

Added line #L142 was not covered by tests


Expand Down
3 changes: 2 additions & 1 deletion mmdeploy/pytorch/functions/repeat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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),

Check warning on line 23 in mmdeploy/pytorch/functions/repeat.py

View check run for this annotation

Codecov / codecov/patch

mmdeploy/pytorch/functions/repeat.py#L23

Added line #L23 was not covered by tests
*([1] + list(*size))).squeeze(0)
return origin_func(input.unsqueeze(0), *([1] + list(size))).squeeze(0)
else:
return origin_func(input, *size)
2 changes: 1 addition & 1 deletion tests/regression/mmdet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ models:
- *pipeline_trt_dynamic_fp32

- name: CondInst
metafile: /configs/condinst/metafile.yml
metafile: configs/condinst/metafile.yml
model_configs:
- configs/condinst/condinst_r50_fpn_ms-poly-90k_coco_instance.py
pipelines:
Expand Down
18 changes: 7 additions & 11 deletions tests/test_codebase/test_mmdet/test_mmdet_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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)
Expand All @@ -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,
Expand Down

0 comments on commit 520dcd6

Please sign in to comment.