(input, centroid=None, furthest_distance=None)
| 1918 | return knn_pts, knn_idx |
| 1919 | |
| 1920 | def normalize_point_cloud(input, centroid=None, furthest_distance=None): |
| 1921 | # input: (b, 3, n) tensor |
| 1922 | |
| 1923 | if centroid is None: |
| 1924 | # (b, 3, 1) |
| 1925 | centroid = torch.mean(input, dim=-1, keepdim=True) |
| 1926 | # (b, 3, n) |
| 1927 | input = input - centroid |
| 1928 | if furthest_distance is None: |
| 1929 | # (b, 3, n) -> (b, 1, n) -> (b, 1, 1) |
| 1930 | furthest_distance = torch.max(torch.norm(input, p=2, dim=1, keepdim=True), dim=-1, keepdim=True)[0] |
| 1931 | input = input / furthest_distance |
| 1932 | |
| 1933 | return input, centroid, furthest_distance |
| 1934 | |
| 1935 | def midpoint_interpolate(sparse_pts, up_rate=4, normal=False, only_FPS=False): |
| 1936 | # sparse_pts: (b, 3, 256) |
no outgoing calls
no test coverage detected