reduced-3dgs 1.10.7__cp310-cp310-win_amd64.whl → 1.10.12__cp310-cp310-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.
reduced_3dgs/train.py CHANGED
@@ -14,8 +14,12 @@ from reduced_3dgs.quantization import AbstractQuantizer
14
14
  from reduced_3dgs.prepare import modes, prepare_gaussians, prepare_trainer
15
15
 
16
16
 
17
- def prepare_training(sh_degree: int, source: str, device: str, mode: str, trainable_camera: bool = False, load_ply: str = None, load_camera: str = None, load_depth=False, with_scale_reg=False, quantize: bool = False, load_quantized: str = None, configs={}):
18
- dataset = prepare_dataset(source=source, device=device, trainable_camera=trainable_camera, load_camera=load_camera, load_depth=load_depth)
17
+ def prepare_training(
18
+ sh_degree: int, source: str, device: str, mode: str,
19
+ trainable_camera: bool = False, load_ply: str = None, load_camera: str = None,
20
+ load_mask=True, load_depth=True,
21
+ with_scale_reg=False, quantize: bool = False, load_quantized: str = None, configs={}):
22
+ dataset = prepare_dataset(source=source, device=device, trainable_camera=trainable_camera, load_camera=load_camera, load_mask=load_mask, load_depth=load_depth)
19
23
  gaussians = prepare_gaussians(sh_degree=sh_degree, source=source, device=device, trainable_camera=trainable_camera, load_ply=load_ply)
20
24
  trainer, quantizer = prepare_trainer(gaussians=gaussians, dataset=dataset, mode=mode, with_scale_reg=with_scale_reg, quantize=quantize, load_quantized=load_quantized, configs=configs)
21
25
  return dataset, gaussians, trainer, quantizer
@@ -23,26 +27,39 @@ def prepare_training(sh_degree: int, source: str, device: str, mode: str, traina
23
27
 
24
28
  def training(dataset: CameraDataset, gaussians: GaussianModel, trainer: AbstractTrainer, quantizer: AbstractQuantizer, destination: str, iteration: int, save_iterations: List[int], device: str, empty_cache_every_step=False):
25
29
  shutil.rmtree(os.path.join(destination, "point_cloud"), ignore_errors=True) # remove the previous point cloud
26
- pbar = tqdm(range(1, iteration+1))
30
+ pbar = tqdm(range(1, iteration+1), dynamic_ncols=True, desc="Training")
27
31
  epoch = list(range(len(dataset)))
28
32
  epoch_psnr = torch.empty(3, 0, device=device)
33
+ epoch_maskpsnr = torch.empty(3, 0, device=device)
29
34
  ema_loss_for_log = 0.0
30
35
  avg_psnr_for_log = 0.0
36
+ avg_maskpsnr_for_log = 0.0
31
37
  for step in pbar:
32
38
  epoch_idx = step % len(dataset)
33
39
  if epoch_idx == 0:
34
40
  avg_psnr_for_log = epoch_psnr.mean().item()
41
+ avg_maskpsnr_for_log = epoch_maskpsnr.mean().item()
35
42
  epoch_psnr = torch.empty(3, 0, device=device)
43
+ epoch_maskpsnr = torch.empty(3, 0, device=device)
36
44
  random.shuffle(epoch)
37
45
  idx = epoch[epoch_idx]
38
46
  loss, out = trainer.step(dataset[idx])
39
47
  if empty_cache_every_step:
40
48
  torch.cuda.empty_cache()
41
49
  with torch.no_grad():
50
+ ground_truth_image = dataset[idx].ground_truth_image
51
+ rendered_image = out["render"]
52
+ epoch_psnr = torch.concat([epoch_psnr, psnr(rendered_image, ground_truth_image)], dim=1)
53
+ if dataset[idx].ground_truth_image_mask is not None:
54
+ ground_truth_maskimage = ground_truth_image * dataset[idx].ground_truth_image_mask
55
+ rendered_maskimage = rendered_image * dataset[idx].ground_truth_image_mask
56
+ epoch_maskpsnr = torch.concat([epoch_maskpsnr, psnr(rendered_maskimage, ground_truth_maskimage)], dim=1)
42
57
  ema_loss_for_log = 0.4 * loss.item() + 0.6 * ema_loss_for_log
43
- epoch_psnr = torch.concat([epoch_psnr, psnr(out["render"], dataset[idx].ground_truth_image)], dim=1)
44
58
  if step % 10 == 0:
45
- pbar.set_postfix({'epoch': step // len(dataset), 'loss': ema_loss_for_log, 'psnr': avg_psnr_for_log, 'n': gaussians._xyz.shape[0]})
59
+ postfix = {'epoch': step // len(dataset), 'loss': ema_loss_for_log, 'psnr': avg_psnr_for_log, 'n': gaussians._xyz.shape[0]}
60
+ if avg_maskpsnr_for_log > 0:
61
+ postfix['psnr (mask)'] = avg_maskpsnr_for_log
62
+ pbar.set_postfix(postfix)
46
63
  if step in save_iterations:
47
64
  save_path = os.path.join(destination, "point_cloud", "iteration_" + str(step))
48
65
  os.makedirs(save_path, exist_ok=True)
@@ -68,6 +85,7 @@ if __name__ == "__main__":
68
85
  parser.add_argument("-l", "--load_ply", default=None, type=str)
69
86
  parser.add_argument("--load_camera", default=None, type=str)
70
87
  parser.add_argument("--quantize", action='store_true')
88
+ parser.add_argument("--no_image_mask", action="store_true")
71
89
  parser.add_argument("--no_depth_data", action='store_true')
72
90
  parser.add_argument("--with_scale_reg", action="store_true")
73
91
  parser.add_argument("--load_quantized", default=None, type=str)
@@ -83,7 +101,9 @@ if __name__ == "__main__":
83
101
  configs = {o.split("=", 1)[0]: eval(o.split("=", 1)[1]) for o in args.option}
84
102
  dataset, gaussians, trainer, quantizer = prepare_training(
85
103
  sh_degree=args.sh_degree, source=args.source, device=args.device, mode=args.mode, trainable_camera="camera" in args.mode,
86
- load_ply=args.load_ply, load_camera=args.load_camera, load_depth=not args.no_depth_data, with_scale_reg=args.with_scale_reg,
104
+ load_ply=args.load_ply, load_camera=args.load_camera,
105
+ load_mask=not args.no_image_mask, load_depth=not args.no_depth_data,
106
+ with_scale_reg=args.with_scale_reg,
87
107
  quantize=args.quantize, load_quantized=args.load_quantized, configs=configs)
88
108
  dataset.save_cameras(os.path.join(args.destination, "cameras.json"))
89
109
  torch.cuda.empty_cache()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reduced_3dgs
3
- Version: 1.10.7
3
+ Version: 1.10.12
4
4
  Summary: Refactored code for the paper "Reducing the Memory Footprint of 3D Gaussian Splatting"
5
5
  Home-page: https://github.com/yindaheng98/reduced-3dgs
6
6
  Author: yindaheng98
@@ -35,6 +35,7 @@ This repository contains the **refactored Python code for [Reduced-3DGS](https:/
35
35
 
36
36
  * [Pytorch](https://pytorch.org/) (v2.4 or higher recommended)
37
37
  * [CUDA Toolkit](https://developer.nvidia.com/cuda-12-4-0-download-archive) (12.4 recommended, should match with PyTorch version)
38
+ * (Optional) [cuML](https://github.com/rapidsai/cuml) for faster vector quantization
38
39
 
39
40
  (Optional) If you have trouble with [`gaussian-splatting`](https://github.com/yindaheng98/gaussian-splatting), try to install it from source:
40
41
  ```sh
@@ -2,13 +2,13 @@ reduced_3dgs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  reduced_3dgs/combinations.py,sha256=dRrtTIQLggUP22Olp0DVSlD0C8YDgnrpTlrCcGZyWM0,9441
3
3
  reduced_3dgs/prepare.py,sha256=MFUUckRHKfgcva4ZOBxfPFyE95N-OlCQLplpmEPuzOk,4440
4
4
  reduced_3dgs/quantize.py,sha256=BVqBb2tQgiP3hap5-OByD8VELtJJGfEeFzaVFyzCJZU,2572
5
- reduced_3dgs/train.py,sha256=yRQPQv-hTOBQN-tqGHYs2aIZ0AbWq158CXpthYN2cfw,5666
6
- reduced_3dgs/diff_gaussian_rasterization/_C.cp310-win_amd64.pyd,sha256=umncdQpRjdTtR0dzSn1EW-ZG_gkEweJvFOi23QxGOWM,1610752
5
+ reduced_3dgs/train.py,sha256=P9GCoEVl_VGldKuA3ycj1nea5rTc3xqu_f02a8oe-Lc,6734
6
+ reduced_3dgs/diff_gaussian_rasterization/_C.cp310-win_amd64.pyd,sha256=T3bwC1BQvTG47Ha-VCGjtTOPU81HYv7TCsa0lYAqVF4,1610752
7
7
  reduced_3dgs/diff_gaussian_rasterization/__init__.py,sha256=oV6JjTc-50MscX4XHeIWSgLr3l8Y25knBIs-0gRbJr4,7932
8
8
  reduced_3dgs/importance/__init__.py,sha256=neJsbY5cLikEGBQGdR4MjwCQ5VWVikT1357DwL0EtWU,289
9
9
  reduced_3dgs/importance/combinations.py,sha256=F9IYDZ6iquZw5Djn2An88dlp2MUGieAyuZyVaDZdSts,2962
10
10
  reduced_3dgs/importance/trainer.py,sha256=Sj4ORvoYtFT7z3hifzFZDfhFyqumHraXyk3vMVtk0AU,12661
11
- reduced_3dgs/importance/diff_gaussian_rasterization/_C.cp310-win_amd64.pyd,sha256=o6a3wL0bQzhmpj3qIk3g_6T80xPthL1bO9kJlcuiATs,1302016
11
+ reduced_3dgs/importance/diff_gaussian_rasterization/_C.cp310-win_amd64.pyd,sha256=TLEsXJXzHr3fYCzE-P17gGkpoQ_X80LsvqCeT9vzchQ,1302016
12
12
  reduced_3dgs/importance/diff_gaussian_rasterization/__init__.py,sha256=Tix8auyXBb_QFQtXrV3sLE9kdnl5zgHH0BbqcFzDp84,12850
13
13
  reduced_3dgs/pruning/__init__.py,sha256=E_YxJ9cDV_B6EJbYUBEcuRYMIht_C72rI1VJUXFCLpM,201
14
14
  reduced_3dgs/pruning/combinations.py,sha256=xO39d08DEsDnKI5np_1xQ4H29O486Q_cThLfWhlH810,2385
@@ -21,9 +21,9 @@ reduced_3dgs/quantization/wrapper.py,sha256=cyXqfJgo9b3fS7DYXxOk5LmQudvrEhweOebF
21
21
  reduced_3dgs/shculling/__init__.py,sha256=nP2BejDCUdCmJNRbg0hfhHREO6jyZXwIcRiw6ttVgqo,149
22
22
  reduced_3dgs/shculling/gaussian_model.py,sha256=f8QWaL09vaV9Tcf6Dngjg_Fmk1wTQPAjWhuhI_N02Y8,2877
23
23
  reduced_3dgs/shculling/trainer.py,sha256=9hwR77djhZpyf-URhwKHjnLbe0ZAOS-DIw58RzkcHXQ,6369
24
- reduced_3dgs/simple_knn/_C.cp310-win_amd64.pyd,sha256=6DC6PsctGeSGC1i_ruHtFyDnWilQ9smDsz2ZhROCJeE,1248768
25
- reduced_3dgs-1.10.7.dist-info/licenses/LICENSE.md,sha256=LQ4_LAqlncGkg_mQy5ykMAFtQDSPB0eKmIEtBut0yjw,4916
26
- reduced_3dgs-1.10.7.dist-info/METADATA,sha256=XffxXiROEKO9jeTVmfiZcWBAHK0cgSS9B6ZKvY5wT5k,12317
27
- reduced_3dgs-1.10.7.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
28
- reduced_3dgs-1.10.7.dist-info/top_level.txt,sha256=PpU5aT3-baSCdqCtTaZknoB32H93UeKCkYDkRCCZMEI,13
29
- reduced_3dgs-1.10.7.dist-info/RECORD,,
24
+ reduced_3dgs/simple_knn/_C.cp310-win_amd64.pyd,sha256=elGT2b5IdsO5qGhW0XBj_5qdUyJBNveMgEM6yVdoHiY,1248768
25
+ reduced_3dgs-1.10.12.dist-info/licenses/LICENSE.md,sha256=LQ4_LAqlncGkg_mQy5ykMAFtQDSPB0eKmIEtBut0yjw,4916
26
+ reduced_3dgs-1.10.12.dist-info/METADATA,sha256=7cQgH63LmWATezhRqXDPA6ytT_Ld9mYXKppGqvR8QTw,12404
27
+ reduced_3dgs-1.10.12.dist-info/WHEEL,sha256=KUuBC6lxAbHCKilKua8R9W_TM71_-9Sg5uEP3uDWcoU,101
28
+ reduced_3dgs-1.10.12.dist-info/top_level.txt,sha256=PpU5aT3-baSCdqCtTaZknoB32H93UeKCkYDkRCCZMEI,13
29
+ reduced_3dgs-1.10.12.dist-info/RECORD,,