mit-han-lab/pvcnn

What is meant by features, and coords!?

a-akram-98 opened this issue · 2 comments

In this code:

class Voxelization(nn.Module):
    def __init__(self, resolution, normalize=True, eps=0):
        super().__init__()
        self.r = int(resolution)
        self.normalize = normalize
        self.eps = eps

    def forward(self, features, coords):
        coords = coords.detach()
        norm_coords = coords - coords.mean(2, keepdim=True)
        if self.normalize:
            norm_coords = norm_coords / (norm_coords.norm(dim=1, keepdim=True).max(dim=2, keepdim=True).values * 2.0 + self.eps) + 0.5
        else:
            norm_coords = (norm_coords + 1) / 2.0
        norm_coords = torch.clamp(norm_coords * self.r, 0, self.r - 1)
        vox_coords = torch.round(norm_coords).to(torch.int32)
        return F.avg_voxelize(features, vox_coords, self.r), norm_coords

    def extra_repr(self):
        return 'resolution={}{}'.format(self.r, ', normalized eps = {}'.format(self.eps) if self.normalize else '')

What is the input Features and Coords, In Kitti Dataset for example point cloud are defined as (N,4) as 3 for x,y,z, and one for reflectance so what is the features and coords from those 4 and why coords.detach() this will cut the gradient flow !?

coords will be [x, y, z] and feats will be [x, y, z, reflectance]. We apply the detach operation to coords because its gradient is not required (and it Is not differentiable anyway after the torch.round operation).

I'm closing this issue due to inactivity. Please feel free to reopen it if the problem has not been resolved.