提交 5792f346 编写于 作者: K Kaipeng Deng 提交者: GitHub

remove actual_shape in resize_nearest and use_progam_cache in yolov3/infer.py (#3617)

* remove actual_shape

* add fpn fix
上级 b1ef0310
......@@ -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):
......
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册