From ad70182ce4d9263040666e87a5c98e747c9133ff Mon Sep 17 00:00:00 2001 From: Yun Wang <75126151+WY-74@users.noreply.github.com> Date: Sat, 13 Dec 2025 11:15:09 +0800 Subject: [PATCH] Remove col_discard and row_discard Remove col_discard and row_discard from assign_anchor_to_bbox we can use -1 to replace col_discard and row_discard --- chapter_computer-vision/anchor.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/chapter_computer-vision/anchor.md b/chapter_computer-vision/anchor.md index 0f05e71a7..518e7e499 100644 --- a/chapter_computer-vision/anchor.md +++ b/chapter_computer-vision/anchor.md @@ -451,15 +451,13 @@ def assign_anchor_to_bbox(ground_truth, anchors, device, iou_threshold=0.5): anc_i = torch.nonzero(max_ious >= iou_threshold).reshape(-1) box_j = indices[max_ious >= iou_threshold] anchors_bbox_map[anc_i] = box_j - col_discard = torch.full((num_anchors,), -1) - row_discard = torch.full((num_gt_boxes,), -1) for _ in range(num_gt_boxes): max_idx = torch.argmax(jaccard) box_idx = (max_idx % num_gt_boxes).long() anc_idx = (max_idx / num_gt_boxes).long() anchors_bbox_map[anc_idx] = box_idx - jaccard[:, box_idx] = col_discard - jaccard[anc_idx, :] = row_discard + jaccard[:, box_idx] = -1 + jaccard[anc_idx, :] = -1 return anchors_bbox_map ```