diff --git a/ppdet/modeling/anchor_heads/yolo_head.py b/ppdet/modeling/anchor_heads/yolo_head.py index 2b1b3da78876fc56c6394f48502fcbf2fe692d5e..54fbb0b7e5b6a84922ab44df2fe9bad4ad422f64 100644 --- a/ppdet/modeling/anchor_heads/yolo_head.py +++ b/ppdet/modeling/anchor_heads/yolo_head.py @@ -183,13 +183,13 @@ class YOLOv3Head(object): return route, tip def _upsample(self, input, scale=2, upsample='nearest', name=None): - upsample = upsample.copy() if upsample == 'nearest': out = fluid.layers.resize_nearest( input=input, scale=float(scale), name=name) else: assert isinstance( upsample, dict), "Unknown upsample method: {}".format(upsample) + upsample = upsample.copy() assert upsample['type'] in [ 'carafe' ], 'Unknown upsample type {}'.format(upsample['type']) diff --git a/ppdet/modeling/ops.py b/ppdet/modeling/ops.py index 43ce45dc9639d1b428a6510dbb35b9939234a17f..a2cd8aca0a2168b47f2bd05a7fcd8f71c78dbffc 100644 --- a/ppdet/modeling/ops.py +++ b/ppdet/modeling/ops.py @@ -75,7 +75,6 @@ def _conv_bn(input, ch_out, filter_size, stride, padding, act=None, name=None): filter_size=filter_size, stride=stride, padding=padding, - act=None, param_attr=ParamAttr(name=name + ".conv.weights"), bias_attr=False) @@ -1588,6 +1587,8 @@ class CARAFEUpsample(object): w = input_shape[3] out = fluid.layers.reshape( out, [b, int(input.shape[1]), -1, h * self.scale, w * self.scale]) + + weight = fluid.layers.expand_as(weight, out) out = fluid.layers.reduce_sum(weight * out, dim=2) return out