diff --git a/ppdet/modeling/architectures/picodet.py b/ppdet/modeling/architectures/picodet.py index 7e9382b7c0b83b102e90dc5f1cfa0d490f738248..9c67005b0aee1bddf27b0a8cda1c3155a64f3c25 100644 --- a/ppdet/modeling/architectures/picodet.py +++ b/ppdet/modeling/architectures/picodet.py @@ -64,7 +64,7 @@ class PicoDet(BaseArch): fpn_feats = self.neck(body_feats) head_outs = self.head(fpn_feats, self.deploy) if self.training or self.deploy: - return head_outs + return head_outs, None else: im_shape = self.inputs['im_shape'] scale_factor = self.inputs['scale_factor'] diff --git a/ppdet/modeling/assigners/simota_assigner.py b/ppdet/modeling/assigners/simota_assigner.py index 34e26eee6f25e7211c845c747743f8c6fa35550a..eacd23022f1c95b05fad17c742932e8d80987324 100644 --- a/ppdet/modeling/assigners/simota_assigner.py +++ b/ppdet/modeling/assigners/simota_assigner.py @@ -172,16 +172,11 @@ class SimOTAAssigner(object): (num_bboxes, ), 0, dtype=paddle.int64).numpy() if num_gt == 0 or num_bboxes == 0: # No ground truth or boxes, return empty assignment - max_overlaps = decoded_bboxes.new_zeros((num_bboxes, )) - if num_gt == 0: - # No truth, assign everything to background - assigned_gt_inds[:] = 0 - if gt_labels is None: - assigned_labels = None - else: - assigned_labels = paddle.full( - (num_bboxes, ), -1, dtype=paddle.int64) - return + priors = priors.numpy() + labels = np.ones([num_bboxes], dtype=np.int64) * self.num_classes + label_weights = np.ones([num_bboxes], dtype=np.float32) + bbox_targets = np.zeros_like(priors) + return priors, labels, label_weights, bbox_targets, 0 valid_mask, is_in_boxes_and_center = self.get_in_gt_and_in_center_info( priors, gt_bboxes) @@ -238,8 +233,6 @@ class SimOTAAssigner(object): gt_bboxes = gt_bboxes.numpy() assigned_gt_inds[valid_mask] = matched_gt_inds + 1 - assigned_labels = np.full((num_bboxes, ), self.num_classes) - assigned_labels[valid_mask] = gt_labels.squeeze(-1)[matched_gt_inds] pos_inds, neg_inds, pos_gt_bboxes, pos_assigned_gt_inds \ = self.get_sample(assigned_gt_inds, gt_bboxes) diff --git a/ppdet/modeling/heads/simota_head.py b/ppdet/modeling/heads/simota_head.py index e312726dab72476eee7946fa73a8f4dce2495366..2a870dc13c7570ebd78899d47bbfe7eaaf3101cd 100644 --- a/ppdet/modeling/heads/simota_head.py +++ b/ppdet/modeling/heads/simota_head.py @@ -127,11 +127,6 @@ class OTAHead(GFLHead): gt_labels): """Compute targets for priors in a single image. """ - num_gts = gt_labels.shape[0] - # No target - if num_gts == 0: - pass - centors, labels, label_weights, bbox_targets, pos_num = self.assigner( F.sigmoid(cls_preds), centors, decoded_bboxes, gt_bboxes, gt_labels)