(self, matches, all_matches, match_quality_matrix)
Produce additional matches for predictions that have only low-quality matches.
        Specifically, for each ground-truth find the set of predictions that have
        maximum overlap with it (including ties); for each prediction in that set, if
        it is unmatched, then match it to the ground-truth with which it has the highest
        quality value.
Produce additional matches for predictions that have only low-quality matches.
        Specifically, for each ground-truth find the set of predictions that have
        maximum overlap with it (including ties); for each prediction in that set, if
        it is unmatched, then match it to the ground-truth with which it has the highest
        quality value.
Produce additional matches for predictions that have only low - quality matches . Specifically for each ground - truth find the set of predictions that have maximum overlap with it ( including ties ) ; for each prediction in that set if it is unmatched then match it to the ground - truth with which it has the highest quality value .
def set_low_quality_matches_(self, matches, all_matches, match_quality_matrix):
        """
        Produce additional matches for predictions that have only low-quality matches.
        Specifically, for each ground-truth find the set of predictions that have
        maximum overlap with it (including ties); for each prediction in that set, if
        it is unmatched, then match it to the ground-truth with which it has the highest
        quality value.
        """
        # For each gt, find the prediction with which it has highest quality
        highest_quality_foreach_gt, _ = match_quality_matrix.max(dim=1)
        # Find highest quality match available, even if it is low, including ties
        gt_pred_pairs_of_highest_quality = torch.nonzero(
            match_quality_matrix == highest_quality_foreach_gt[:, None]
        )
        # Example gt_pred_pairs_of_highest_quality:
        #   tensor([[    0, 39796],
        #           [    1, 32055],
        #           [    1, 32070],
        #           [    2, 39190],
        #           [    2, 40255],
        #           [    3, 40390],
        #           [    3, 41455],
        #           [    4, 45470],
        #           [    5, 45325],
        #           [    5, 46390]])
        # Each row is a (gt index, prediction index)
        # Note how gt items 1, 2, 3, and 5 each have two ties

        pred_inds_to_update = gt_pred_pairs_of_highest_quality[:, 1]
        matches[pred_inds_to_update] = all_matches[pred_inds_to_update]
def set_low_quality_matches_ ( self , matches , all_matches , match_quality_matrix ) : # For each gt, find the prediction with which it has highest quality highest_quality_foreach_gt , _ = match_quality_matrix . max ( dim = 1 ) # Find highest quality match available, even if it is low, including ties gt_pred_pairs_of_highest_quality = torch . nonzero ( match_quality_matrix == highest_quality_foreach_gt [ : , None ] ) # Example gt_pred_pairs_of_highest_quality: #   tensor([[    0, 39796], #           [    1, 32055], #           [    1, 32070], #           [    2, 39190], #           [    2, 40255], #           [    3, 40390], #           [    3, 41455], #           [    4, 45470], #           [    5, 45325], #           [    5, 46390]]) # Each row is a (gt index, prediction index) # Note how gt items 1, 2, 3, and 5 each have two ties pred_inds_to_update = gt_pred_pairs_of_highest_quality [ : , 1 ] matches [ pred_inds_to_update ] = all_matches [ pred_inds_to_update ]