[Fix] fix det with static shape (#1049)

* fix det with static shape

* update rotated detection

* fix resize keep ratio
pull/1095/head
q.yao 2022-09-23 14:45:57 +08:00 committed by GitHub
parent 676f1bf49c
commit 6ac9c4d7a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View File

@ -42,10 +42,14 @@ def process_model_config(model_cfg: mmcv.Config,
transforms = cfg.data.test.pipeline[1]['transforms']
for trans in transforms:
trans_type = trans['type']
if trans_type == 'Resize':
if trans_type == 'Resize' and len(
input_shape) != 1 and input_shape[0] != input_shape[1]:
trans['keep_ratio'] = False
elif trans_type == 'Pad':
trans['size_divisor'] = 1
if 'size_divisor' in trans:
trans['size_divisor'] = 1
else:
trans['size'] = tuple(input_shape)
cfg.data.test.pipeline = replace_ImageToTensor(cfg.data.test.pipeline)
return cfg

View File

@ -64,7 +64,7 @@ def process_model_config(model_cfg: mmcv.Config,
transforms = cfg.data.test.pipeline[1]['transforms']
for trans in transforms:
trans_type = trans['type']
if trans_type == 'Pad':
if trans_type == 'Pad' and 'size_divisor' in trans:
trans['size_divisor'] = 1
cfg.data.test.pipeline = replace_ImageToTensor(cfg.data.test.pipeline)