-
Couldn't load subscription status.
- Fork 2.7k
Open
Description
gaussian-splatting/scene/gaussian_model.py
Lines 452 to 469 in 54c035f
| def densify_and_prune(self, max_grad, min_opacity, extent, max_screen_size, radii): | |
| grads = self.xyz_gradient_accum / self.denom | |
| grads[grads.isnan()] = 0.0 | |
| self.tmp_radii = radii | |
| self.densify_and_clone(grads, max_grad, extent) | |
| self.densify_and_split(grads, max_grad, extent) | |
| prune_mask = (self.get_opacity < min_opacity).squeeze() | |
| if max_screen_size: | |
| big_points_vs = self.max_radii2D > max_screen_size | |
| big_points_ws = self.get_scaling.max(dim=1).values > 0.1 * extent | |
| prune_mask = torch.logical_or(torch.logical_or(prune_mask, big_points_vs), big_points_ws) | |
| self.prune_points(prune_mask) | |
| tmp_radii = self.tmp_radii | |
| self.tmp_radii = None | |
| torch.cuda.empty_cache() |
gaussian-splatting/scene/gaussian_model.py
Lines 388 to 407 in 54c035f
| def densification_postfix(self, new_xyz, new_features_dc, new_features_rest, new_opacities, new_scaling, new_rotation, new_tmp_radii): | |
| d = {"xyz": new_xyz, | |
| "f_dc": new_features_dc, | |
| "f_rest": new_features_rest, | |
| "opacity": new_opacities, | |
| "scaling" : new_scaling, | |
| "rotation" : new_rotation} | |
| optimizable_tensors = self.cat_tensors_to_optimizer(d) | |
| self._xyz = optimizable_tensors["xyz"] | |
| self._features_dc = optimizable_tensors["f_dc"] | |
| self._features_rest = optimizable_tensors["f_rest"] | |
| self._opacity = optimizable_tensors["opacity"] | |
| self._scaling = optimizable_tensors["scaling"] | |
| self._rotation = optimizable_tensors["rotation"] | |
| self.tmp_radii = torch.cat((self.tmp_radii, new_tmp_radii)) | |
| self.xyz_gradient_accum = torch.zeros((self.get_xyz.shape[0], 1), device="cuda") | |
| self.denom = torch.zeros((self.get_xyz.shape[0], 1), device="cuda") | |
| self.max_radii2D = torch.zeros((self.get_xyz.shape[0]), device="cuda") |
max_radii2D was used for gaussian prune. While it would be always set to zero before by densification_postfix of densify_and_clone/densify_and_split.
Metadata
Metadata
Assignees
Labels
No labels