(proposals_list,
                 valid_flag_list,
                 gt_bboxes_list,
                 img_metas,
                 cfg,
                 gt_bboxes_ignore_list=None,
                 gt_labels_list=None,
                 label_channels=1,
                 sampling=True,
                 unmap_outputs=True)
return (labels_list, label_weights_list, bbox_gt_list, proposals_list,
            proposal_weights_list, num_total_pos, num_total_neg)
Compute corresponding GT box and classification targets for proposals.

    Args:
        points_list (list[list]): Multi level points of each image.
        valid_flag_list (list[list]): Multi level valid flags of each image.
        gt_bboxes_list (list[Tensor]): Ground truth bboxes of each image.
        img_metas (list[dict]): Meta info of each image.
        cfg (dict): train sample configs.

    Returns:
        tuple
Compute corresponding GT box and classification targets for proposals.
Compute corresponding GT box and classification targets for proposals .
def point_target(proposals_list,
                 valid_flag_list,
                 gt_bboxes_list,
                 img_metas,
                 cfg,
                 gt_bboxes_ignore_list=None,
                 gt_labels_list=None,
                 label_channels=1,
                 sampling=True,
                 unmap_outputs=True):
    """Compute corresponding GT box and classification targets for proposals.

    Args:
        points_list (list[list]): Multi level points of each image.
        valid_flag_list (list[list]): Multi level valid flags of each image.
        gt_bboxes_list (list[Tensor]): Ground truth bboxes of each image.
        img_metas (list[dict]): Meta info of each image.
        cfg (dict): train sample configs.

    Returns:
        tuple
    """
    num_imgs = len(img_metas)
    assert len(proposals_list) == len(valid_flag_list) == num_imgs

    # points number of multi levels
    num_level_proposals = [points.size(0) for points in proposals_list[0]]

    # concat all level points and flags to a single tensor
    for i in range(num_imgs):
        assert len(proposals_list[i]) == len(valid_flag_list[i])
        proposals_list[i] = torch.cat(proposals_list[i])
        valid_flag_list[i] = torch.cat(valid_flag_list[i])

    # compute targets for each image
    if gt_bboxes_ignore_list is None:
        gt_bboxes_ignore_list = [None for _ in range(num_imgs)]
    if gt_labels_list is None:
        gt_labels_list = [None for _ in range(num_imgs)]
    (all_labels, all_label_weights, all_bbox_gt, all_proposals,
     all_proposal_weights, pos_inds_list, neg_inds_list) = multi_apply(
         point_target_single,
         proposals_list,
         valid_flag_list,
         gt_bboxes_list,
         gt_bboxes_ignore_list,
         gt_labels_list,
         cfg=cfg,
         label_channels=label_channels,
         sampling=sampling,
         unmap_outputs=unmap_outputs)
    # no valid points
    if any([labels is None for labels in all_labels]):
        return None
    # sampled points of all images
    num_total_pos = sum([max(inds.numel(), 1) for inds in pos_inds_list])
    num_total_neg = sum([max(inds.numel(), 1) for inds in neg_inds_list])
    labels_list = images_to_levels(all_labels, num_level_proposals)
    label_weights_list = images_to_levels(all_label_weights,
                                          num_level_proposals)
    bbox_gt_list = images_to_levels(all_bbox_gt, num_level_proposals)
    proposals_list = images_to_levels(all_proposals, num_level_proposals)
    proposal_weights_list = images_to_levels(all_proposal_weights,
                                             num_level_proposals)
    return (labels_list, label_weights_list, bbox_gt_list, proposals_list,
            proposal_weights_list, num_total_pos, num_total_neg)
def point_target ( proposals_list , valid_flag_list , gt_bboxes_list , img_metas , cfg , gt_bboxes_ignore_list = None , gt_labels_list = None , label_channels = 1 , sampling = True , unmap_outputs = True ) : num_imgs = len ( img_metas ) assert len ( proposals_list ) == len ( valid_flag_list ) == num_imgs # points number of multi levels num_level_proposals = [ points . size ( 0 ) for points in proposals_list [ 0 ] ] # concat all level points and flags to a single tensor for i in range ( num_imgs ) : assert len ( proposals_list [ i ] ) == len ( valid_flag_list [ i ] ) proposals_list [ i ] = torch . cat ( proposals_list [ i ] ) valid_flag_list [ i ] = torch . cat ( valid_flag_list [ i ] ) # compute targets for each image if gt_bboxes_ignore_list is None : gt_bboxes_ignore_list = [ None for _ in range ( num_imgs ) ] if gt_labels_list is None : gt_labels_list = [ None for _ in range ( num_imgs ) ] ( all_labels , all_label_weights , all_bbox_gt , all_proposals , all_proposal_weights , pos_inds_list , neg_inds_list ) = multi_apply ( point_target_single , proposals_list , valid_flag_list , gt_bboxes_list , gt_bboxes_ignore_list , gt_labels_list , cfg = cfg , label_channels = label_channels , sampling = sampling , unmap_outputs = unmap_outputs ) # no valid points if any ( [ labels is None for labels in all_labels ] ) : return None # sampled points of all images num_total_pos = sum ( [ max ( inds . numel ( ) , 1 ) for inds in pos_inds_list ] ) num_total_neg = sum ( [ max ( inds . numel ( ) , 1 ) for inds in neg_inds_list ] ) labels_list = images_to_levels ( all_labels , num_level_proposals ) label_weights_list = images_to_levels ( all_label_weights , num_level_proposals ) bbox_gt_list = images_to_levels ( all_bbox_gt , num_level_proposals ) proposals_list = images_to_levels ( all_proposals , num_level_proposals ) proposal_weights_list = images_to_levels ( all_proposal_weights , num_level_proposals ) return ( labels_list , label_weights_list , bbox_gt_list , proposals_list , proposal_weights_list , num_total_pos , num_total_neg )