diff --git a/ppdet/modeling/anchor_heads/yolo_head.py b/ppdet/modeling/anchor_heads/yolo_head.py index 19829233f4833669131ecaa3fb13002d2062e93e..7e756f267762827b3666e8143dce9a695fc526e2 100644 --- a/ppdet/modeling/anchor_heads/yolo_head.py +++ b/ppdet/modeling/anchor_heads/yolo_head.py @@ -148,18 +148,8 @@ class YOLOv3Head(object): return route, tip def _upsample(self, input, scale=2, name=None): - # get dynamic upsample output shape - shape_nchw = fluid.layers.shape(input) - shape_hw = fluid.layers.slice( - shape_nchw, axes=[0], starts=[2], ends=[4]) - shape_hw.stop_gradient = True - in_shape = fluid.layers.cast(shape_hw, dtype='int32') - out_shape = in_shape * scale - out_shape.stop_gradient = True - - # reisze by actual_shape out = fluid.layers.resize_nearest( - input=input, scale=scale, actual_shape=out_shape, name=name) + input=input, scale=float(scale), name=name) return out def _parse_anchors(self, anchors): diff --git a/ppdet/modeling/backbones/fpn.py b/ppdet/modeling/backbones/fpn.py index 762df42d1c8e44588a50f4826638e6d218a3d14c..9bd491a662dd640c62668c5878d47ea48c21d223 100644 --- a/ppdet/modeling/backbones/fpn.py +++ b/ppdet/modeling/backbones/fpn.py @@ -87,13 +87,8 @@ class FPN(object): learning_rate=2., regularizer=L2Decay(0.)), name=lateral_name) - shape = fluid.layers.shape(upper_output) - shape_hw = fluid.layers.slice(shape, axes=[0], starts=[2], ends=[4]) - out_shape_ = shape_hw * 2 - out_shape = fluid.layers.cast(out_shape_, dtype='int32') - out_shape.stop_gradient = True topdown = fluid.layers.resize_nearest( - upper_output, scale=2., actual_shape=out_shape, name=topdown_name) + upper_output, scale=2., name=topdown_name) return lateral + topdown