From 1c8b0368248c8ca87fbc5afca860b6ec0ee7401d Mon Sep 17 00:00:00 2001 From: shangliang Xu Date: Tue, 12 Apr 2022 20:48:43 +0800 Subject: [PATCH] fix assigner dtype error (#5666) --- ppdet/modeling/assigners/atss_assigner.py | 3 ++- ppdet/modeling/assigners/task_aligned_assigner.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ppdet/modeling/assigners/atss_assigner.py b/ppdet/modeling/assigners/atss_assigner.py index e9543c638..550962d84 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 cb0cf1db0..b97923f6c 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]) -- GitLab