Skip to content

Commit 7237b91

Browse files
authored
[Fix]: Fix mmrotate and regression script (#1917)
* fix pipeline * disable test for openvino and sdk+torchscript for mmpose
1 parent 9fa7403 commit 7237b91

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
_base_ = ['./rotated-detection_static.py', '../_base_/backends/onnxruntime.py']
22

3-
onnx_config = dict(output_names=['dets', 'labels'], input_shape=None)
3+
onnx_config = dict(output_names=['dets', 'labels'], input_shape=[1024, 1024])

mmdeploy/codebase/mmrotate/deploy/rotated_detection.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,12 @@ def process_model_config(model_cfg: Config,
8585
cfg.test_pipeline[0].type = 'mmdet.LoadImageFromNDArray'
8686

8787
pipeline = cfg.test_pipeline
88-
89-
for i, transform in enumerate(pipeline):
90-
# for static exporting
91-
if input_shape is not None and transform.type == 'Resize':
92-
pipeline[i].keep_ratio = False
93-
pipeline[i].scale = tuple(input_shape)
88+
# for static exporting
89+
if input_shape is not None:
90+
for i, transform in enumerate(pipeline):
91+
if transform.type in ['Resize', 'mmdet.Resize']:
92+
pipeline[i].keep_ratio = False
93+
pipeline[i].scale = tuple(input_shape)
9494

9595
pipeline = [
9696
transform for transform in pipeline
@@ -209,15 +209,12 @@ def create_input(
209209
cfg = process_model_config(self.model_cfg, imgs, input_shape)
210210

211211
pipeline = cfg.test_pipeline
212+
# for static exporting
212213
if not dynamic_flag:
213-
transform = pipeline[1]
214-
if 'transforms' in transform:
215-
transform_list = transform['transforms']
216-
for i, step in enumerate(transform_list):
217-
if step['type'] == 'Pad' and 'pad_to_square' in step \
218-
and step['pad_to_square']:
219-
transform_list.pop(i)
220-
break
214+
for i, trans in enumerate(pipeline):
215+
if trans['type'] == 'Pad' and 'pad_to_square' in trans \
216+
and trans['pad_to_square']:
217+
trans.pop(i)
221218
test_pipeline = Compose(pipeline)
222219

223220
data = []
@@ -261,6 +258,7 @@ def get_preprocess(self, *args, **kwargs) -> Dict:
261258
input_shape = get_input_shape(self.deploy_cfg)
262259
model_cfg = process_model_config(self.model_cfg, [''], input_shape)
263260
pipeline = model_cfg.test_pipeline
261+
pipeline = replace_RResize(pipeline)
264262
meta_keys = [
265263
'filename', 'ori_filename', 'ori_shape', 'img_shape', 'pad_shape',
266264
'scale_factor', 'flip', 'flip_direction', 'img_norm_cfg',

tests/regression/mmpose.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ openvino:
5151
deploy_config: configs/mmpose/pose-detection_openvino_static-256x192.py
5252
pipeline_openvino_static_fp32_256x256: &pipeline_openvino_static_fp32_256x256
5353
convert_image: *convert_image
54-
backend_test: *default_backend_test
54+
backend_test: False
5555
deploy_config: configs/mmpose/pose-detection_openvino_static-256x256.py
5656

5757
ncnn:
@@ -74,7 +74,6 @@ torchscript:
7474
pipeline_ts_static_fp32: &pipeline_ts_fp32
7575
convert_image: *convert_image
7676
backend_test: *default_backend_test
77-
sdk_config: *sdk_static
7877
deploy_config: configs/mmpose/pose-detection_torchscript.py
7978

8079
models:

tools/regression_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def get_pytorch_result(model_name: str, meta_info: dict, checkpoint_path: Path,
332332
}
333333

334334
# get pytorch fps value
335-
fps_info = model_info.get('Metadata').get('inference time (ms/im)')
335+
fps_info = model_info.get('Metadata', {}).get('inference time (ms/im)')
336336
if fps_info is None:
337337
fps = '-'
338338
elif isinstance(fps_info, list):

0 commit comments

Comments
 (0)