@@ -85,12 +85,12 @@ def process_model_config(model_cfg: Config,
85
85
cfg .test_pipeline [0 ].type = 'mmdet.LoadImageFromNDArray'
86
86
87
87
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 )
94
94
95
95
pipeline = [
96
96
transform for transform in pipeline
@@ -209,15 +209,12 @@ def create_input(
209
209
cfg = process_model_config (self .model_cfg , imgs , input_shape )
210
210
211
211
pipeline = cfg .test_pipeline
212
+ # for static exporting
212
213
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 )
221
218
test_pipeline = Compose (pipeline )
222
219
223
220
data = []
@@ -261,6 +258,7 @@ def get_preprocess(self, *args, **kwargs) -> Dict:
261
258
input_shape = get_input_shape (self .deploy_cfg )
262
259
model_cfg = process_model_config (self .model_cfg , ['' ], input_shape )
263
260
pipeline = model_cfg .test_pipeline
261
+ pipeline = replace_RResize (pipeline )
264
262
meta_keys = [
265
263
'filename' , 'ori_filename' , 'ori_shape' , 'img_shape' , 'pad_shape' ,
266
264
'scale_factor' , 'flip' , 'flip_direction' , 'img_norm_cfg' ,
0 commit comments