MCPcopy Create free account
hub / github.com/QWTforGithub/T2LDM / normalize_point_cloud

Function normalize_point_cloud

utils/common.py:1920–1933  ·  view source on GitHub ↗
(input, centroid=None, furthest_distance=None)

Source from the content-addressed store, hash-verified

1918 return knn_pts, knn_idx
1919
1920def 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
1935def midpoint_interpolate(sparse_pts, up_rate=4, normal=False, only_FPS=False):
1936 # sparse_pts: (b, 3, 256)

Callers 1

midpoint_interpolateFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected