diff --git a/PaddleCV/yolov3/README.md b/PaddleCV/yolov3/README.md index 8b9ecff5c74c59405b4f97564c404527abbde1cb..d2747df2c88241b97cc5d6a53a641db4671c1427 100644 --- a/PaddleCV/yolov3/README.md +++ b/PaddleCV/yolov3/README.md @@ -12,7 +12,7 @@ ## Installation -Running sample code in this directory requires PaddelPaddle Fluid v.1.5 and later. If the PaddlePaddle on your device is lower than this version, please follow the instructions in [installation document](http://www.paddlepaddle.org/documentation/docs/en/1.4/beginners_guide/install/index_en.html) and make an update. +Running sample code in this directory requires PaddelPaddle Fluid v.1.4 and later. If the PaddlePaddle on your device is lower than this version, please follow the instructions in [installation document](http://www.paddlepaddle.org/documentation/docs/en/1.4/beginners_guide/install/index_en.html) and make an update. ## Introduction diff --git a/PaddleCV/yolov3/README_cn.md b/PaddleCV/yolov3/README_cn.md index 662143c2b9ddb3c0217283f8bbe594695328347d..247dbc7ef48180672a34b05033bbdf2ce9dcd06b 100644 --- a/PaddleCV/yolov3/README_cn.md +++ b/PaddleCV/yolov3/README_cn.md @@ -12,7 +12,7 @@ ## 安装 -在当前目录下运行样例代码需要PadddlePaddle Fluid的v.1.5或以上的版本。如果你的运行环境中的PaddlePaddle低于此版本,请根据[安装文档](http://paddlepaddle.org/documentation/docs/zh/1.4/beginners_guide/install/index_cn.html)中的说明来更新PaddlePaddle。 +在当前目录下运行样例代码需要PadddlePaddle Fluid的v.1.4或以上的版本。如果你的运行环境中的PaddlePaddle低于此版本,请根据[安装文档](http://paddlepaddle.org/documentation/docs/zh/1.4/beginners_guide/install/index_cn.html)中的说明来更新PaddlePaddle。 ## 简介 diff --git a/PaddleCV/yolov3/models/yolov3.py b/PaddleCV/yolov3/models/yolov3.py index bfb9ed0adc325ee3894a53c4d387b4be15a41285..ef57abddf52811ea5cdc4ee4c54d3163accd86fb 100644 --- a/PaddleCV/yolov3/models/yolov3.py +++ b/PaddleCV/yolov3/models/yolov3.py @@ -46,9 +46,19 @@ def yolo_detection_block(input, channel, is_test=True, name=None): return route, tip def upsample(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=float(scale), + scale=scale, + actual_shape=out_shape, name=name) return out