Skip to content

Commit

Permalink
[Fix]: Fix mmrotate and regression script (#1917)
Browse files Browse the repository at this point in the history
* fix pipeline

* disable test for openvino and sdk+torchscript for mmpose
  • Loading branch information
RunningLeon authored Mar 28, 2023
1 parent 9fa7403 commit 7237b91
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 18 deletions.
2 changes: 1 addition & 1 deletion configs/mmrotate/rotated-detection_onnxruntime_static.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
_base_ = ['./rotated-detection_static.py', '../_base_/backends/onnxruntime.py']

onnx_config = dict(output_names=['dets', 'labels'], input_shape=None)
onnx_config = dict(output_names=['dets', 'labels'], input_shape=[1024, 1024])
26 changes: 12 additions & 14 deletions mmdeploy/codebase/mmrotate/deploy/rotated_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,12 @@ def process_model_config(model_cfg: Config,
cfg.test_pipeline[0].type = 'mmdet.LoadImageFromNDArray'

pipeline = cfg.test_pipeline

for i, transform in enumerate(pipeline):
# for static exporting
if input_shape is not None and transform.type == 'Resize':
pipeline[i].keep_ratio = False
pipeline[i].scale = tuple(input_shape)
# for static exporting
if input_shape is not None:
for i, transform in enumerate(pipeline):
if transform.type in ['Resize', 'mmdet.Resize']:
pipeline[i].keep_ratio = False
pipeline[i].scale = tuple(input_shape)

pipeline = [
transform for transform in pipeline
Expand Down Expand Up @@ -209,15 +209,12 @@ def create_input(
cfg = process_model_config(self.model_cfg, imgs, input_shape)

pipeline = cfg.test_pipeline
# for static exporting
if not dynamic_flag:
transform = pipeline[1]
if 'transforms' in transform:
transform_list = transform['transforms']
for i, step in enumerate(transform_list):
if step['type'] == 'Pad' and 'pad_to_square' in step \
and step['pad_to_square']:
transform_list.pop(i)
break
for i, trans in enumerate(pipeline):
if trans['type'] == 'Pad' and 'pad_to_square' in trans \
and trans['pad_to_square']:
trans.pop(i)
test_pipeline = Compose(pipeline)

data = []
Expand Down Expand Up @@ -261,6 +258,7 @@ def get_preprocess(self, *args, **kwargs) -> Dict:
input_shape = get_input_shape(self.deploy_cfg)
model_cfg = process_model_config(self.model_cfg, [''], input_shape)
pipeline = model_cfg.test_pipeline
pipeline = replace_RResize(pipeline)
meta_keys = [
'filename', 'ori_filename', 'ori_shape', 'img_shape', 'pad_shape',
'scale_factor', 'flip', 'flip_direction', 'img_norm_cfg',
Expand Down
3 changes: 1 addition & 2 deletions tests/regression/mmpose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ openvino:
deploy_config: configs/mmpose/pose-detection_openvino_static-256x192.py
pipeline_openvino_static_fp32_256x256: &pipeline_openvino_static_fp32_256x256
convert_image: *convert_image
backend_test: *default_backend_test
backend_test: False
deploy_config: configs/mmpose/pose-detection_openvino_static-256x256.py

ncnn:
Expand All @@ -74,7 +74,6 @@ torchscript:
pipeline_ts_static_fp32: &pipeline_ts_fp32
convert_image: *convert_image
backend_test: *default_backend_test
sdk_config: *sdk_static
deploy_config: configs/mmpose/pose-detection_torchscript.py

models:
Expand Down
2 changes: 1 addition & 1 deletion tools/regression_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def get_pytorch_result(model_name: str, meta_info: dict, checkpoint_path: Path,
}

# get pytorch fps value
fps_info = model_info.get('Metadata').get('inference time (ms/im)')
fps_info = model_info.get('Metadata', {}).get('inference time (ms/im)')
if fps_info is None:
fps = '-'
elif isinstance(fps_info, list):
Expand Down

0 comments on commit 7237b91

Please sign in to comment.