From 114cdb1b70913c9395a0ccc5de399c08e56ef633 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Sat, 13 Feb 2021 22:20:24 +0800 Subject: [PATCH] [cherry-pick] fix bbox_num 0, test=dygraph (#2201) * fix bbox_num 0 after nms, test=dygraph * add copyright, test=dygraph --- dygraph/ppdet/modeling/post_process.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/dygraph/ppdet/modeling/post_process.py b/dygraph/ppdet/modeling/post_process.py index 232c0d859..2e3da37be 100644 --- a/dygraph/ppdet/modeling/post_process.py +++ b/dygraph/ppdet/modeling/post_process.py @@ -1,3 +1,17 @@ +# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + import numpy as np import paddle import paddle.nn as nn @@ -40,6 +54,7 @@ class BBoxPostProcess(object): bbox_pred = paddle.to_tensor( np.array( [[-1, 0.0, 0.0, 0.0, 0.0, 0.0]], dtype='float32')) + bbox_num = paddle.to_tensor(np.array([1], dtype='int32')) return bbox_pred, bbox_num def get_pred(self, bboxes, bbox_num, im_shape, scale_factor): -- GitLab