From cb89c8d0567073aa3a1506fc679617c8ac13a1b2 Mon Sep 17 00:00:00 2001 From: shangliang Xu Date: Wed, 10 Aug 2022 11:12:44 +0800 Subject: [PATCH] [dev] fix trt nms error output in ppyoloe (#6607) --- ppdet/modeling/layers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ppdet/modeling/layers.py b/ppdet/modeling/layers.py index 4afc7f560..0fac4d9ca 100644 --- a/ppdet/modeling/layers.py +++ b/ppdet/modeling/layers.py @@ -481,8 +481,9 @@ class MultiClassNMS(object): # TODO(wangxinxin08): tricky switch to run nms on tensorrt kwargs.update({'nms_eta': 1.1}) bbox, bbox_num, _ = ops.multiclass_nms(bboxes, score, **kwargs) - mask = paddle.slice(bbox, [-1], [0], [1]) != -1 - bbox = paddle.masked_select(bbox, mask).reshape((-1, 6)) + bbox = bbox.reshape([1, -1, 6]) + idx = paddle.nonzero(bbox[..., 0] != -1) + bbox = paddle.gather_nd(bbox, idx) return bbox, bbox_num, None else: return ops.multiclass_nms(bboxes, score, **kwargs) @@ -1353,7 +1354,7 @@ class ConvMixer(nn.Layer): Seq, ActBn = nn.Sequential, lambda x: Seq(x, nn.GELU(), nn.BatchNorm2D(dim)) Residual = type('Residual', (Seq, ), {'forward': lambda self, x: self[0](x) + x}) - return Seq(* [ + return Seq(*[ Seq(Residual( ActBn( nn.Conv2D( -- GitLab