Skip to content

Commit 16b7b19

Browse files
ApdowJNwilsonCernWq
authored andcommitted
Use fused instead of accumulated in terms of wording
1 parent 8fd003c commit 16b7b19

File tree

7 files changed

+47
-38
lines changed

7 files changed

+47
-38
lines changed

configs/apps/cusfm_3dgut.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# @package _global_
2+
3+
# order in which configs override each other (/* - denotes a relative search path)
4+
defaults:
5+
- /base_gs
6+
- /dataset: colmap
7+
- /initialization: fused_point_cloud
8+
- /render: 3dgut
9+
- _self_
10+
11+
# overwrite of default parameters
12+
val_frequency: 999999 # never validate
13+
14+
15+
initialization:
16+
fused_point_cloud_path: ??? # Path to fused point cloud PLY file to be provided by user at runtime

configs/apps/cusfm_3dgut_mcmc.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
defaults:
55
- /base_mcmc
66
- /dataset: colmap
7-
- /initialization: accumulated_point_cloud
7+
- /initialization: fused_point_cloud
88
- /render: 3dgut
99
- _self_
1010

1111
# overwrite of default parameters
1212
val_frequency: 999999 # never validate
1313

1414
initialization:
15-
accumulated_point_cloud_path: ??? # Path to accumulated point cloud PLY file to be provided by user at runtime
15+
fused_point_cloud_path: ??? # Path to fused point cloud PLY file to be provided by user at runtime

configs/initialization/accumulated_point_cloud.yaml

Lines changed: 0 additions & 5 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
method: fused_point_cloud
2+
observation_scale_factor: 0.01
3+
use_observation_points: false
4+
fused_point_cloud_path: ??? # Path to fused point cloud PLY file
5+

threedgrut/datasets/utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,11 @@ def read_colmap_extrinsics_text(path):
479479
with open(path, "r") as fid:
480480
# Skip comment lines and get valid lines
481481
lines = (line.strip() for line in fid)
482-
# lines = (line for line in lines if line and not line.startswith("#"))
482+
# This update handles cases in images.txt where no 2D points are associated with an image.
483+
# In such cases, some entries contain only:
484+
# IMAGE_ID, QW, QX, QY, QZ, TX, TY, TZ, CAMERA_ID, NAME
485+
# and do not include the usual POINTS2D[] line (which normally lists (X, Y, POINT3D_ID)).
486+
# The following logic checks for missing points line and handles it properly:
483487
lines = (line for line in lines if line == "" or not line.startswith("#"))
484488
# Process lines in pairs (image info + points info)
485489
try:

threedgrut/model/model.py

Lines changed: 16 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -252,55 +252,44 @@ def init_from_colmap(self, root_path: str, observer_pts):
252252
file_pts, observer_pts, file_rgb, use_observer_pts=self.conf.initialization.use_observation_points
253253
)
254254

255-
def init_from_accumulated_point_cloud(self, pc_path: str, observer_pts):
255+
def init_from_fused_point_cloud(self, pc_path: str, observer_pts):
256256
"""
257-
Initialize gaussians from an accumulated point cloud PLY file.
257+
Initialize gaussians from an fused point cloud PLY file.
258258
Similar to init_from_colmap but loads from a given PLY file instead of sparse/0/points3D.txt
259-
259+
260260
Args:
261261
pc_path: Path to the PLY point cloud file
262262
observer_pts: Observer points tensor for scale initialization
263263
"""
264-
logger.info(f"Loading accumulated point cloud from {pc_path}...")
265-
264+
logger.info(f"Loading fused point cloud from {pc_path}...")
265+
266266
# Read PLY file
267267
plydata = PlyData.read(pc_path)
268-
vertices = plydata['vertex']
269-
268+
vertices = plydata["vertex"]
269+
270270
# Extract XYZ coordinates
271-
xyz = np.stack([
272-
vertices['x'],
273-
vertices['y'],
274-
vertices['z']
275-
], axis=1).astype(np.float32)
276-
271+
xyz = np.stack([vertices["x"], vertices["y"], vertices["z"]], axis=1).astype(np.float32)
272+
277273
# Extract RGB colors (check if they exist)
278-
if 'red' in vertices and 'green' in vertices and 'blue' in vertices:
279-
rgb = np.stack([
280-
vertices['red'],
281-
vertices['green'],
282-
vertices['blue']
283-
], axis=1).astype(np.uint8)
274+
if "red" in vertices and "green" in vertices and "blue" in vertices:
275+
rgb = np.stack([vertices["red"], vertices["green"], vertices["blue"]], axis=1).astype(np.uint8)
284276
else:
285277
# If no colors, initialize with random colors
286278
logger.warning("No RGB data found in point cloud, using random colors")
287279
rgb = np.random.randint(0, 256, size=(len(vertices), 3), dtype=np.uint8)
288-
280+
289281
# Convert to torch tensors
290282
file_pts = torch.tensor(xyz, dtype=torch.float32, device=self.device)
291283
file_rgb = torch.tensor(rgb, dtype=torch.uint8, device=self.device)
292-
284+
293285
logger.info(f"Loaded {len(file_pts)} points from accumulated point cloud")
294-
286+
295287
# Initialize using the same method as COLMAP
296288
assert file_rgb.dtype == torch.uint8, "Expecting RGB values to be in [0, 255] range"
297289
self.default_initialize_from_points(
298-
file_pts,
299-
observer_pts,
300-
file_rgb,
301-
use_observer_pts=self.conf.initialization.use_observation_points
290+
file_pts, observer_pts, file_rgb, use_observer_pts=self.conf.initialization.use_observation_points
302291
)
303-
292+
304293
def init_from_pretrained_point_cloud(self, pc_path: str, set_optimizable_parameters: bool = True):
305294
data = PlyData.read(pc_path)
306295
num_gaussians = len(data["vertex"])

threedgrut/trainer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,13 +256,13 @@ def setup_training(self, conf: DictConfig, model: MixtureOfGaussians, train_data
256256
train_dataset.get_observer_points(), dtype=torch.float32, device=self.device
257257
)
258258
model.init_from_colmap(conf.path, observer_points)
259-
case "accumulated_point_cloud":
259+
case "fused_point_cloud":
260260
observer_points = torch.tensor(
261261
train_dataset.get_observer_points(), dtype=torch.float32, device=self.device
262262
)
263-
ply_path = conf.initialization.accumulated_point_cloud_path
263+
ply_path = conf.initialization.fused_point_cloud_path
264264
logger.info(f"Initializing from accumulated point cloud: {ply_path}")
265-
model.init_from_accumulated_point_cloud(ply_path, observer_points)
265+
model.init_from_fused_point_cloud(ply_path, observer_points)
266266
case "point_cloud":
267267
try:
268268
ply_path = os.path.join(conf.path, "point_cloud.ply")

0 commit comments

Comments
 (0)