From a794caccf76d58b24a29c9c97c3842debb7924cc Mon Sep 17 00:00:00 2001 From: JYChen Date: Fri, 14 Jan 2022 17:36:17 +0800 Subject: [PATCH] fix fuse_normalize not working when export model (#5106) * fix fuse_normalize not working when export model * fix solov2 by keeping inputs setting before building model --- ppdet/modeling/architectures/meta_arch.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/ppdet/modeling/architectures/meta_arch.py b/ppdet/modeling/architectures/meta_arch.py index d01c34735..1f13c8540 100644 --- a/ppdet/modeling/architectures/meta_arch.py +++ b/ppdet/modeling/architectures/meta_arch.py @@ -63,10 +63,15 @@ class BaseArch(nn.Layer): inputs_list.append(inputs) else: inputs_list.extend(inputs) - outs = [] for inp in inputs_list: - self.inputs = inp + if self.fuse_norm: + self.inputs['image'] = ( + inp['image'] * self.scale - self.mean) / self.std + self.inputs['im_shape'] = inp['im_shape'] + self.inputs['scale_factor'] = inp['scale_factor'] + else: + self.inputs = inp outs.append(self.get_pred()) # multi-scale test -- GitLab