gaussian-splatting 1.19.0__cp311-cp311-win_amd64.whl → 1.19.2__cp311-cp311-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -15,8 +15,8 @@ from gaussian_splatting.prepare import prepare_dataset, prepare_gaussians
15
15
  def prepare_rendering(
16
16
  sh_degree: int, source: str, device: str,
17
17
  trainable_camera: bool = False, load_ply: str = None, load_camera: str = None,
18
- load_depth=True) -> Tuple[CameraDataset, GaussianModel]:
19
- dataset = prepare_dataset(source=source, device=device, trainable_camera=trainable_camera, load_camera=load_camera, load_mask=True, load_depth=load_depth)
18
+ load_mask=True, load_depth=True) -> Tuple[CameraDataset, GaussianModel]:
19
+ dataset = prepare_dataset(source=source, device=device, trainable_camera=trainable_camera, load_camera=load_camera, load_mask=load_mask, load_depth=load_depth)
20
20
  gaussians = prepare_gaussians(sh_degree=sh_degree, source=source, device=device, trainable_camera=trainable_camera, load_ply=load_ply)
21
21
  return dataset, gaussians
22
22
 
@@ -57,13 +57,16 @@ def rendering(
57
57
  gt_path = os.path.join(save, "gt")
58
58
  makedirs(render_path, exist_ok=True)
59
59
  makedirs(gt_path, exist_ok=True)
60
- pbar = tqdm(dataset, desc="Rendering progress")
60
+ pbar = tqdm(dataset, dynamic_ncols=True, desc="Rendering")
61
61
  with open(os.path.join(save, "quality.csv"), "w") as f:
62
62
  f.write("name,psnr,ssim,lpips\n")
63
63
  for idx, camera in enumerate(pbar):
64
64
  out = gaussians(camera)
65
65
  rendering = out["render"]
66
66
  gt = camera.ground_truth_image
67
+ if camera.ground_truth_image_mask is not None:
68
+ gt *= camera.ground_truth_image_mask
69
+ rendering *= camera.ground_truth_image_mask
67
70
  psnr_value = psnr(rendering, gt).mean().item()
68
71
  ssim_value = ssim(rendering, gt).mean().item()
69
72
  lpips_value = lpips(rendering, gt).mean().item()
@@ -96,6 +99,7 @@ if __name__ == "__main__":
96
99
  parser.add_argument("--load_camera", default=None, type=str)
97
100
  parser.add_argument("--mode", choices=["base", "camera"], default="base")
98
101
  parser.add_argument("--device", default="cuda", type=str)
102
+ parser.add_argument("--no_image_mask", action="store_true")
99
103
  parser.add_argument("--no_rescale_depth_gt", action="store_true")
100
104
  parser.add_argument("--save_depth_pcd", action="store_true")
101
105
  args = parser.parse_args()
@@ -104,5 +108,6 @@ if __name__ == "__main__":
104
108
  with torch.no_grad():
105
109
  dataset, gaussians = prepare_rendering(
106
110
  sh_degree=args.sh_degree, source=args.source, device=args.device, trainable_camera=args.mode == "camera",
107
- load_ply=load_ply, load_camera=args.load_camera, load_depth=args.save_depth_pcd)
111
+ load_ply=load_ply, load_camera=args.load_camera,
112
+ load_mask=not args.no_image_mask, load_depth=args.save_depth_pcd)
108
113
  rendering(dataset, gaussians, save, save_pcd=args.save_depth_pcd, rescale_depth_gt=not args.no_rescale_depth_gt)
@@ -31,7 +31,7 @@ def save_cfg_args(destination: str, sh_degree: int, source: str):
31
31
 
32
32
  def training(dataset: CameraDataset, gaussians: GaussianModel, trainer: AbstractTrainer, destination: str, iteration: int, save_iterations: List[int], device: str):
33
33
  shutil.rmtree(os.path.join(destination, "point_cloud"), ignore_errors=True) # remove the previous point cloud
34
- pbar = tqdm(range(1, iteration+1))
34
+ pbar = tqdm(range(1, iteration+1), dynamic_ncols=True, desc="Training")
35
35
  epoch = list(range(len(dataset)))
36
36
  epoch_psnr = torch.empty(3, 0, device=device)
37
37
  ema_loss_for_log = 0.0
@@ -45,8 +45,13 @@ def training(dataset: CameraDataset, gaussians: GaussianModel, trainer: Abstract
45
45
  idx = epoch[epoch_idx]
46
46
  loss, out = trainer.step(dataset[idx])
47
47
  with torch.no_grad():
48
+ ground_truth_image = dataset[idx].ground_truth_image
49
+ rendered_image = out["render"]
50
+ if dataset[idx].ground_truth_image_mask is not None:
51
+ ground_truth_image *= dataset[idx].ground_truth_image_mask
52
+ rendered_image *= dataset[idx].ground_truth_image_mask
48
53
  ema_loss_for_log = 0.4 * loss.item() + 0.6 * ema_loss_for_log
49
- epoch_psnr = torch.concat([epoch_psnr, psnr(out["render"], dataset[idx].ground_truth_image)], dim=1)
54
+ epoch_psnr = torch.concat([epoch_psnr, psnr(rendered_image, ground_truth_image)], dim=1)
50
55
  if step % 10 == 0:
51
56
  pbar.set_postfix({'epoch': step // len(dataset), 'loss': ema_loss_for_log, 'psnr': avg_psnr_for_log, 'n': gaussians._xyz.shape[0]})
52
57
  if step in save_iterations:
@@ -105,7 +105,9 @@ class BaseTrainer(AbstractTrainer):
105
105
  gt = gt * mask.unsqueeze(0)
106
106
  case "bg_color":
107
107
  assert mask is not None, "Mask is required for 'bg_color' mask policy"
108
- gt = gt * mask.unsqueeze(0) + (1 - mask.unsqueeze(0)) * camera.bg_color.unsqueeze(-1).unsqueeze(-1)
108
+ # bg_color after postprocess
109
+ bg_color = camera.postprocess(camera, camera.bg_color.unsqueeze(-1).unsqueeze(-1)).clamp(0.0, 1.0)
110
+ gt = gt * mask.unsqueeze(0) + (1 - mask.unsqueeze(0)) * bg_color
109
111
  case _:
110
112
  raise ValueError(f"Unknown mask policy: {self.mask_mode}")
111
113
  Ll1 = l1_loss(render, gt)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gaussian_splatting
3
- Version: 1.19.0
3
+ Version: 1.19.2
4
4
  Summary: Refactored python training and inference code for 3D Gaussian Splatting
5
5
  Home-page: https://github.com/yindaheng98/gaussian-splatting
6
6
  Author: yindaheng98
@@ -3,8 +3,8 @@ gaussian_splatting/camera.py,sha256=vo7mu6lyFpIhDqOAgNiJuPan8t_nDJn5cJkAYygLFcA,
3
3
  gaussian_splatting/camera_trainable.py,sha256=nI6hFFRV2ev7VwLlKUbzEdN9zUmngYZAANGLr1p1yBA,3841
4
4
  gaussian_splatting/gaussian_model.py,sha256=_Dy_dDa2prALhVgg428a-O8-8PODg3c_JPkOJJ8X4o8,13275
5
5
  gaussian_splatting/prepare.py,sha256=rgwdDhPU-sS57ZgTLKwzognbS1hfR2JtjZqlC4FqPbI,3241
6
- gaussian_splatting/render.py,sha256=MSvJiOpyIr5IgJeaB6xj2GDcK4Jb6mcj7CWVXb-ajIk,5988
7
- gaussian_splatting/train.py,sha256=a3vHZf5sX5eVsxv394pmwTSon1mPevQVPGAWwYHqaY8,5386
6
+ gaussian_splatting/render.py,sha256=RhZoILWxtkuDEhiL2cQsvZWNBmkyDAROYdvrQaFhPkc,6295
7
+ gaussian_splatting/train.py,sha256=RdPg53jf2C8SBosTod5GmoDcIIk83hhdAIcd1prvTcM,5735
8
8
  gaussian_splatting/dataset/__init__.py,sha256=-runuT-61P0YVpfV_WXqwUZM1oY0N012YH13Bt3rzSU,138
9
9
  gaussian_splatting/dataset/camera_trainable.py,sha256=Kd8v-_ZJ9dLIQ2QyVOXbmouYf5QjbgOgHNRHVpkgCms,5041
10
10
  gaussian_splatting/dataset/dataset.py,sha256=0tmIZ5P7kOEdABiEAXPznkRN91e5rcT5VsAzOLoOuEM,2392
@@ -12,12 +12,12 @@ gaussian_splatting/dataset/colmap/__init__.py,sha256=YEYT2k2WJSqrkkZq4KAJYS9UMgq
12
12
  gaussian_splatting/dataset/colmap/dataset.py,sha256=0UBQ6ynOqElHZSphJ-MSbYQqCwwYZaAXl1y9AY5YKuY,4720
13
13
  gaussian_splatting/dataset/colmap/params_init.py,sha256=6_6gZ0Wl4aZrps2PJ_U234sxW5D-vOTfwioVa1FWC-E,1802
14
14
  gaussian_splatting/dataset/colmap/read_write_model.py,sha256=TenI7ai5UV7Ksg2vAXvJWnYFwOOo1tlS_633RfCLuQU,23137
15
- gaussian_splatting/diff_gaussian_rasterization/_C.cp311-win_amd64.pyd,sha256=oyjIZwIYxtZpEXbhpWSJmj3U3jA32LlKd9OAxLAgI4U,1295360
15
+ gaussian_splatting/diff_gaussian_rasterization/_C.cp311-win_amd64.pyd,sha256=n3TrGEe3-zOhJj-tNZiY0CBgPns4_PpTYa5FTcO8d0E,1295360
16
16
  gaussian_splatting/diff_gaussian_rasterization/__init__.py,sha256=a9D0IZiPx-Mk1795hSq54T-NYT4MtEN_MZrxeMhw0Eo,6705
17
- gaussian_splatting/simple_knn/_C.cp311-win_amd64.pyd,sha256=ll9GppZDR03FGo6SiP8_Rm24BcVGuhve11Bj_xX-XlA,1164288
17
+ gaussian_splatting/simple_knn/_C.cp311-win_amd64.pyd,sha256=SVEJlbMeELkNeeSb_rxSbisEhMFEA3fmWWPOaHecDRU,1164288
18
18
  gaussian_splatting/trainer/__init__.py,sha256=962fEY8A0spSQn5de_d_LkPOjA1PYKrLbuAkxwZo7mI,940
19
19
  gaussian_splatting/trainer/abc.py,sha256=_gcqmEobhSOdZnMyNb2oKS6cZJ-Mg3oYL4xJ5Y3_oic,4262
20
- gaussian_splatting/trainer/base.py,sha256=GfPifKjelRoCOXLJP6_tk1jgFWTJloBaCyUiVCcE9u4,4724
20
+ gaussian_splatting/trainer/base.py,sha256=fngLruQ9hMSNLFbc_5woG7jm6cidpoZ0dzk_zImRaE4,4851
21
21
  gaussian_splatting/trainer/camera_trainable.py,sha256=TBQXn2f578qeizPz6tgqFm-GRvttv9duuB1xx7_J9TQ,4567
22
22
  gaussian_splatting/trainer/combinations.py,sha256=7NX4fXdDOx8ri1_mgAaWNx-YVdo5XsqMlr9qy-Ll2MM,5329
23
23
  gaussian_splatting/trainer/depth.py,sha256=PxWBSNxzoQcRfCFI_yJnJMS6s8qFWn81CXK6O6ffXL0,7059
@@ -45,8 +45,8 @@ gaussian_splatting/utils/lpipsPyTorch/modules/__init__.py,sha256=47DEQpj8HBSa-_T
45
45
  gaussian_splatting/utils/lpipsPyTorch/modules/lpips.py,sha256=YScu0oXIEstCCjJVRItS_R_csUw70sBMFuP8Syl2UdI,1187
46
46
  gaussian_splatting/utils/lpipsPyTorch/modules/networks.py,sha256=kqIebq7dAhHypTXweFVEf_RDbN7_Zv7O3MlD-CfRvpg,2788
47
47
  gaussian_splatting/utils/lpipsPyTorch/modules/utils.py,sha256=TDcem3E3HqDNN2MT8qlOL_BKVHeO4HRE77JxF-kOWk8,915
48
- gaussian_splatting-1.19.0.dist-info/licenses/LICENSE.md,sha256=bMuRQKn0u485mx8JBBTJ5Simc-aWHaQsxmoB6jsg5oE,4752
49
- gaussian_splatting-1.19.0.dist-info/METADATA,sha256=L0gv8LTr-DW4WFGl_jIFl568SuvIqlhsp863yh5LSZI,17183
50
- gaussian_splatting-1.19.0.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
51
- gaussian_splatting-1.19.0.dist-info/top_level.txt,sha256=uaYrPYXRHhpybgCnsoazTcdhpzZGnLT_vd5eoRzBWWI,19
52
- gaussian_splatting-1.19.0.dist-info/RECORD,,
48
+ gaussian_splatting-1.19.2.dist-info/licenses/LICENSE.md,sha256=bMuRQKn0u485mx8JBBTJ5Simc-aWHaQsxmoB6jsg5oE,4752
49
+ gaussian_splatting-1.19.2.dist-info/METADATA,sha256=LlY7Xiln84Uz24GZUl14IqxRsWL3nUXOe0jLZHNdAdY,17183
50
+ gaussian_splatting-1.19.2.dist-info/WHEEL,sha256=JLOMsP7F5qtkAkINx5UnzbFguf8CqZeraV8o04b0I8I,101
51
+ gaussian_splatting-1.19.2.dist-info/top_level.txt,sha256=uaYrPYXRHhpybgCnsoazTcdhpzZGnLT_vd5eoRzBWWI,19
52
+ gaussian_splatting-1.19.2.dist-info/RECORD,,