def nearest_neighbor_interpolate(unknown, known, known_feats): """ :param pts: (n, 4) tensor of the bxyz positions of the unknown features :param ctr: (m, 4) tensor of the bxyz positions of the known features :param ctr_feats: (m, C) tensor of features to be propigated :return: new_features: (n, C) tensor of the features of the unknown features """ dist, idx = pointnet2_utils.three_nn(unknown, known) dist_recip = 1.0 / (dist + 1e-8) norm = torch.sum(dist_recip, dim=1, keepdim=True) weight = dist_recip / norm interpolated_feats = pointnet2_utils.three_interpolate( known_feats, idx, weight) return interpolated_feats
def nearest_neighbor_interpolate(unknown, known, known_feats): """ :param pts: (n, 4) tensor of the bxyz positions of the unknown features [34114, 4] :param ctr: (m, 4) tensor of the bxyz positions of the known features [52913, 4] :param ctr_feats: (m, C) tensor of features to be propigated [52913, 32] :return: new_features: (n, C) tensor of the features of the unknown features """ dist, idx = pointnet2_utils.three_nn( unknown, known) # dist: [34114, 3], idx: [34114, 3] dist_recip = 1.0 / (dist + 1e-8) # [34114, 3] norm = torch.sum(dist_recip, dim=1, keepdim=True) # [34114, 1] weight = dist_recip / norm # 权重值 [34114, 3] interpolated_feats = pointnet2_utils.three_interpolate( known_feats, idx, weight) # [34114, 3] return interpolated_feats