未验证 提交 cfb115b9 编写于 作者: F Feng Ni 提交者: GitHub

[dygraph] fix bbox_num 0, test=dygraph (#2200)

* fix bbox_num 0 after nms, test=dygraph

* add copyright, test=dygraph
上级 bda64b5d
# 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 numpy as np
import paddle import paddle
import paddle.nn as nn import paddle.nn as nn
...@@ -40,6 +54,7 @@ class BBoxPostProcess(object): ...@@ -40,6 +54,7 @@ class BBoxPostProcess(object):
bbox_pred = paddle.to_tensor( bbox_pred = paddle.to_tensor(
np.array( np.array(
[[-1, 0.0, 0.0, 0.0, 0.0, 0.0]], dtype='float32')) [[-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 return bbox_pred, bbox_num
def get_pred(self, bboxes, bbox_num, im_shape, scale_factor): def get_pred(self, bboxes, bbox_num, im_shape, scale_factor):
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册