mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-03 14:28:41 +08:00
Exporting Splatfacto: correct errors when there are NaN/Inf values in some attributes (#3032)
* Apply the mask on the proper axis for removing NaN/Inf values * Remove unnecessary indexing which raises an error for 1-d arrays * Update the number of gaussians after removing NaN/Inf values
This commit is contained in:
1 parent
05ce76db99
commit
59d6acf9da
1 file changed
+3
-2
@@ -582,7 +582,7 @@ class ExportGaussianSplat(Exporter):
|
|||||||
select = np.ones(n, dtype=bool)
|
select = np.ones(n, dtype=bool)
|
||||||
for k, t in map_to_tensors.items():
|
for k, t in map_to_tensors.items():
|
||||||
n_before = np.sum(select)
|
n_before = np.sum(select)
|
||||||
select = np.logical_and(select, np.isfinite(t).all())
|
select = np.logical_and(select, np.isfinite(t).all(axis=-1))
|
||||||
n_after = np.sum(select)
|
n_after = np.sum(select)
|
||||||
if n_after < n_before:
|
if n_after < n_before:
|
||||||
CONSOLE.print(f"{n_before - n_after} NaN/Inf elements in {k}")
|
CONSOLE.print(f"{n_before - n_after} NaN/Inf elements in {k}")
|
||||||
@@ -590,7 +590,8 @@ class ExportGaussianSplat(Exporter):
|
|||||||
if np.sum(select) < n:
|
if np.sum(select) < n:
|
||||||
CONSOLE.print(f"values have NaN/Inf in map_to_tensors, only export {np.sum(select)}/{n}")
|
CONSOLE.print(f"values have NaN/Inf in map_to_tensors, only export {np.sum(select)}/{n}")
|
||||||
for k, t in map_to_tensors.items():
|
for k, t in map_to_tensors.items():
|
||||||
map_to_tensors[k] = map_to_tensors[k][select, :]
|
map_to_tensors[k] = map_to_tensors[k][select]
|
||||||
|
count = np.sum(select)
|
||||||
|
|
||||||
ExportGaussianSplat.write_ply(str(filename), count, map_to_tensors)
|
ExportGaussianSplat.write_ply(str(filename), count, map_to_tensors)
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user