コード例 #1
0
 def forward(ctx, xyz, npoint):
     """
     Uses iterative furthest point sampling to select a set of npoint features that have the largest
     minimum distance
     :param ctx:
     :param xyz: (B, N, 3) where N > npoint
     :param npoint: int, number of features in the sampled set
     :return:
          output: (B, npoint) tensor containing the set
     """
     return _ext.furthest_point_sampling(xyz, npoint)
コード例 #2
0
    def forward(ctx, xyz: torch.Tensor, npoint: int) -> torch.Tensor:
        r"""
        Uses iterative furthest point sampling to select a set of npoint features that have the largest
        minimum distance

        Parameters
        ----------
        xyz : torch.Tensor
            (B, N, 3) tensor where N > npoint
        npoint : int32
            number of features in the sampled set

        Returns
        -------
        torch.Tensor
            (B, npoint) tensor containing the set
        """
        return _ext.furthest_point_sampling(xyz, npoint)
コード例 #3
0
 def forward(ctx, xyz, npoint):
     # type: (Any, torch.Tensor, int) -> torch.Tensor
     r"""
     Uses iterative furthest point sampling to select a set of npoint features that have the largest
     minimum distance
     Parameters
     ----------
     xyz : torch.Tensor
         (B, N, 3) tensor where N > npoint
     npoint : int32
         number of features in the sampled set
     Returns
     -------
     torch.Tensor
         (B, npoint) tensor containing the set
     """
     fps_inds = _ext.furthest_point_sampling(xyz, npoint)
     ctx.mark_non_differentiable(fps_inds)
     return fps_inds
コード例 #4
0
def farthest_pts_sampling_tensor(pts, num_samples, return_sampled_idx=False):
    '''

    :param pts: bn, n, 3
    :param num_samples:
    :return:
    '''
    sampled_pts_idx = _ext.furthest_point_sampling(pts, num_samples)
    sampled_pts_idx_viewed = sampled_pts_idx.view(
        sampled_pts_idx.shape[0] * sampled_pts_idx.shape[1]).cuda().type(
            torch.LongTensor)
    batch_idxs = torch.tensor(range(pts.shape[0])).type(torch.LongTensor)
    batch_idxs_viewed = batch_idxs[:, None].repeat(
        1, sampled_pts_idx.shape[1]).view(batch_idxs.shape[0] *
                                          sampled_pts_idx.shape[1])
    sampled_pts = pts[batch_idxs_viewed, sampled_pts_idx_viewed, :]
    sampled_pts = sampled_pts.view(pts.shape[0], num_samples, 3)

    if return_sampled_idx == False:
        return sampled_pts
    else:
        return sampled_pts, sampled_pts_idx