From 71b3fbb18a39e7978234b30ea8b1cee6d4c3e190 Mon Sep 17 00:00:00 2001 From: gaoyuan Date: Tue, 19 Sep 2017 11:28:09 +0800 Subject: [PATCH 1/3] Fix a ssd bug --- paddle/gserver/layers/DetectionOutputLayer.cpp | 3 ++- python/paddle/trainer_config_helpers/layers.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/paddle/gserver/layers/DetectionOutputLayer.cpp b/paddle/gserver/layers/DetectionOutputLayer.cpp index 0cf0a92bf4..570117de65 100644 --- a/paddle/gserver/layers/DetectionOutputLayer.cpp +++ b/paddle/gserver/layers/DetectionOutputLayer.cpp @@ -143,7 +143,8 @@ void DetectionOutputLayer::forward(PassType passType) { resetOutput(numKept, 7); } else { MatrixPtr outV = getOutputValue(); - outV = NULL; + if (outV) + outV->resize(0,0); return; } MatrixPtr outV = getOutputValue(); diff --git a/python/paddle/trainer_config_helpers/layers.py b/python/paddle/trainer_config_helpers/layers.py index 8c7d1738ad..9bdcca1716 100644 --- a/python/paddle/trainer_config_helpers/layers.py +++ b/python/paddle/trainer_config_helpers/layers.py @@ -1224,8 +1224,8 @@ def detection_output_layer(input_loc, name=None): """ Apply the NMS to the output of network and compute the predict bounding - box location. The output of this layer could be None if there is no valid - bounding box. + box location. The output's shape of this layer could be zero if there is + no valid bounding box. :param name: The Layer Name. :type name: basestring From d3deb6faba8404392dd8a81140c643042bf5b082 Mon Sep 17 00:00:00 2001 From: Yuan Gao Date: Tue, 19 Sep 2017 11:58:17 +0800 Subject: [PATCH 2/3] Update DetectionOutputLayer.cpp Fix format --- paddle/gserver/layers/DetectionOutputLayer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/paddle/gserver/layers/DetectionOutputLayer.cpp b/paddle/gserver/layers/DetectionOutputLayer.cpp index 570117de65..274619ec60 100644 --- a/paddle/gserver/layers/DetectionOutputLayer.cpp +++ b/paddle/gserver/layers/DetectionOutputLayer.cpp @@ -143,8 +143,7 @@ void DetectionOutputLayer::forward(PassType passType) { resetOutput(numKept, 7); } else { MatrixPtr outV = getOutputValue(); - if (outV) - outV->resize(0,0); + if (outV) outV->resize(0,0); return; } MatrixPtr outV = getOutputValue(); From 17bc593ca2ef9bb59345580a141e569c8f6b657c Mon Sep 17 00:00:00 2001 From: Yuan Gao Date: Tue, 19 Sep 2017 13:00:49 +0800 Subject: [PATCH 3/3] Update DetectionOutputLayer.cpp Add a space --- paddle/gserver/layers/DetectionOutputLayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/gserver/layers/DetectionOutputLayer.cpp b/paddle/gserver/layers/DetectionOutputLayer.cpp index 274619ec60..f9040f7ae7 100644 --- a/paddle/gserver/layers/DetectionOutputLayer.cpp +++ b/paddle/gserver/layers/DetectionOutputLayer.cpp @@ -143,7 +143,7 @@ void DetectionOutputLayer::forward(PassType passType) { resetOutput(numKept, 7); } else { MatrixPtr outV = getOutputValue(); - if (outV) outV->resize(0,0); + if (outV) outV->resize(0, 0); return; } MatrixPtr outV = getOutputValue();