diff --git a/ppdet/modeling/heads/ppyoloe_head.py b/ppdet/modeling/heads/ppyoloe_head.py index 201aa48120562324fabdeeec341785a76f9b00c4..5784f70f878ad8f44561cca09c109a234331aa4e 100644 --- a/ppdet/modeling/heads/ppyoloe_head.py +++ b/ppdet/modeling/heads/ppyoloe_head.py @@ -323,7 +323,11 @@ class PPYOLOEHead(nn.Layer): assigned_bboxes, assigned_scores, assigned_scores_sum): # select positive samples mask mask_positive = (assigned_labels != self.num_classes) - self.distill_pairs['mask_positive_select'] = mask_positive + + if self.for_distill: + # only used for LD main_kd distill + self.distill_pairs['mask_positive_select'] = mask_positive + num_pos = mask_positive.sum() # pos/neg loss if num_pos > 0: