From d4bbebf3ed1cdcf04ad2e2ed189eb57a7d0d4813 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Thu, 16 Mar 2023 15:58:11 +0800 Subject: [PATCH] fix ppyoloe negative batch assign (#7958) --- ppdet/modeling/assigners/atss_assigner.py | 3 ++- ppdet/modeling/assigners/task_aligned_assigner.py | 3 ++- ppdet/modeling/assigners/task_aligned_assigner_cr.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ppdet/modeling/assigners/atss_assigner.py b/ppdet/modeling/assigners/atss_assigner.py index a1e753c94..54b3d69f7 100644 --- a/ppdet/modeling/assigners/atss_assigner.py +++ b/ppdet/modeling/assigners/atss_assigner.py @@ -126,7 +126,8 @@ class ATSSAssigner(nn.Layer): assigned_bboxes = paddle.zeros([batch_size, num_anchors, 4]) assigned_scores = paddle.zeros( [batch_size, num_anchors, self.num_classes]) - return assigned_labels, assigned_bboxes, assigned_scores + mask_positive = paddle.zeros([batch_size, 1, num_anchors]) + return assigned_labels, assigned_bboxes, assigned_scores, mask_positive # 1. compute iou between gt and anchor bbox, [B, n, L] ious = iou_similarity(gt_bboxes.reshape([-1, 4]), anchor_bboxes) diff --git a/ppdet/modeling/assigners/task_aligned_assigner.py b/ppdet/modeling/assigners/task_aligned_assigner.py index 5a756fa67..636cd967f 100644 --- a/ppdet/modeling/assigners/task_aligned_assigner.py +++ b/ppdet/modeling/assigners/task_aligned_assigner.py @@ -120,7 +120,8 @@ class TaskAlignedAssigner(nn.Layer): assigned_bboxes = paddle.zeros([batch_size, num_anchors, 4]) assigned_scores = paddle.zeros( [batch_size, num_anchors, num_classes]) - return assigned_labels, assigned_bboxes, assigned_scores + mask_positive = paddle.zeros([batch_size, 1, num_anchors]) + return assigned_labels, assigned_bboxes, assigned_scores, mask_positive # compute iou between gt and pred bbox, [B, n, L] ious = batch_iou_similarity(gt_bboxes, pred_bboxes) diff --git a/ppdet/modeling/assigners/task_aligned_assigner_cr.py b/ppdet/modeling/assigners/task_aligned_assigner_cr.py index 4558d6e8e..f96359283 100644 --- a/ppdet/modeling/assigners/task_aligned_assigner_cr.py +++ b/ppdet/modeling/assigners/task_aligned_assigner_cr.py @@ -96,7 +96,8 @@ class TaskAlignedAssigner_CR(nn.Layer): assigned_bboxes = paddle.zeros([batch_size, num_anchors, 4]) assigned_scores = paddle.zeros( [batch_size, num_anchors, num_classes]) - return assigned_labels, assigned_bboxes, assigned_scores + mask_positive = paddle.zeros([batch_size, 1, num_anchors]) + return assigned_labels, assigned_bboxes, assigned_scores, mask_positive # compute iou between gt and pred bbox, [B, n, L] ious = batch_iou_similarity(gt_bboxes, pred_bboxes) -- GitLab