From 73c796704e96186db23e285a7bc0247ffe1b6f64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E7=AB=AF=E5=84=BF?= <12696712+lin-duaner@user.noreply.gitee.com> Date: Fri, 31 Mar 2023 05:38:23 +0000 Subject: [PATCH] =?UTF-8?q?update=20ACL=5FPyTorch/contrib/cv/segmentation/?= =?UTF-8?q?Maskrcnn-mmdet/mmdet=5Fpostprocess.py.=20mask=E5=90=8E=E5=A4=84?= =?UTF-8?q?=E7=90=86torch.cat=E5=9C=A8=E5=BE=AA=E7=8E=AF=E5=86=85=E4=BC=9A?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E8=80=97=E6=97=B6=E8=BE=83=E5=A4=9A=EF=BC=8C?= =?UTF-8?q?=E8=BD=AC=E7=A7=BB=E5=88=B0=E5=BE=AA=E7=8E=AF=E5=A4=96=E9=83=A8?= =?UTF-8?q?=E4=BC=9A=E6=9C=89=E6=89=80=E6=8F=90=E9=80=9F=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 林端儿 <12696712+lin-duaner@user.noreply.gitee.com> --- .../cv/segmentation/Maskrcnn-mmdet/mmdet_postprocess.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ACL_PyTorch/contrib/cv/segmentation/Maskrcnn-mmdet/mmdet_postprocess.py b/ACL_PyTorch/contrib/cv/segmentation/Maskrcnn-mmdet/mmdet_postprocess.py index dbc978e895..beee9b5f05 100644 --- a/ACL_PyTorch/contrib/cv/segmentation/Maskrcnn-mmdet/mmdet_postprocess.py +++ b/ACL_PyTorch/contrib/cv/segmentation/Maskrcnn-mmdet/mmdet_postprocess.py @@ -54,6 +54,7 @@ def postprocess_masks(masks, image_size, net_input_width, net_input_height): ws = int(pad_left + net_input_width - pad_w) masks = masks.to(dtype=torch.float32) res_append = torch.zeros(0, h, w) + tmp=[res_append] if torch.cuda.is_available(): res_append = res_append.to(device='cuda') for i in range(masks.size(0)): @@ -62,8 +63,11 @@ def postprocess_masks(masks, image_size, net_input_width, net_input_height): mask = F.interpolate(mask, size=(int(h), int(w)), mode='bilinear', align_corners=False) mask = mask[0][0] mask = mask.unsqueeze(0) - res_append = torch.cat((res_append, mask)) - + #res_append = torch.cat((res_append, mask)) + tmp.append(mask) + + tmp=tuple(tmp) + res_append = torch.cat(tmp) return res_append[:, None] import pickle -- Gitee