diff --git a/ppdet/modeling/assigners/atss_assigner.py b/ppdet/modeling/assigners/atss_assigner.py index e9543c638a456ba7416d1404fdf5c606a94b2d34..550962d8493a6e29de1b0601b994e64d4cd99cc2 100644 --- a/ppdet/modeling/assigners/atss_assigner.py +++ b/ppdet/modeling/assigners/atss_assigner.py @@ -124,7 +124,8 @@ class ATSSAssigner(nn.Layer): # negative batch if num_max_boxes == 0: - assigned_labels = paddle.full([batch_size, num_anchors], bg_index) + assigned_labels = paddle.full( + [batch_size, num_anchors], bg_index, dtype=gt_labels.dtype) assigned_bboxes = paddle.zeros([batch_size, num_anchors, 4]) assigned_scores = paddle.zeros( [batch_size, num_anchors, self.num_classes]) diff --git a/ppdet/modeling/assigners/task_aligned_assigner.py b/ppdet/modeling/assigners/task_aligned_assigner.py index cb0cf1db0fd952ade87738df93c06be878216856..b97923f6c7b3bbf87a83e0eab91ce3358c316069 100644 --- a/ppdet/modeling/assigners/task_aligned_assigner.py +++ b/ppdet/modeling/assigners/task_aligned_assigner.py @@ -85,7 +85,8 @@ class TaskAlignedAssigner(nn.Layer): # negative batch if num_max_boxes == 0: - assigned_labels = paddle.full([batch_size, num_anchors], bg_index) + assigned_labels = paddle.full( + [batch_size, num_anchors], bg_index, dtype=gt_labels.dtype) assigned_bboxes = paddle.zeros([batch_size, num_anchors, 4]) assigned_scores = paddle.zeros( [batch_size, num_anchors, num_classes])