def METHOD_NAME(self, proposals, targets):
    labels = []
    regression_targets = []
    for proposals_per_image, targets_per_image in zip(proposals, targets):
        matched_targets = self.match_targets_to_proposals(
            proposals_per_image, targets_per_image
        )
        matched_idxs = matched_targets.get_field("matched_idxs")
        labels_per_image = matched_targets.get_field("labels")
        labels_per_image = labels_per_image.to(dtype=torch.int64)
        # Label background (below the low threshold)
        bg_inds = matched_idxs == Matcher.BELOW_LOW_THRESHOLD
        labels_per_image[bg_inds] = 0
        # Label ignore proposals (between low and high thresholds)
        ignore_inds = matched_idxs == Matcher.BETWEEN_THRESHOLDS
        labels_per_image[ignore_inds] = -1  # -1 is ignored by sampler
        # compute regression targets
        regression_targets_per_image = self.box_coder.encode(
            matched_targets.bbox, proposals_per_image.bbox
        )
        labels.append(labels_per_image)
        regression_targets.append(regression_targets_per_image)
    return labels, regression_targets