| 295 | self._rotation_r = nn.Parameter(rots_r.requires_grad_(True)) |
| 296 | |
| 297 | def create_from_pth(self, path, spatial_lr_scale): |
| 298 | assert self.gaussian_dim == 4 and self.rot_4d |
| 299 | self.spatial_lr_scale = spatial_lr_scale |
| 300 | init_4d_gaussian = torch.load(path) |
| 301 | fused_point_cloud = init_4d_gaussian['xyz'].cuda() |
| 302 | features_dc = init_4d_gaussian['features_dc'].cuda() |
| 303 | features_rest = init_4d_gaussian['features_rest'].cuda() |
| 304 | fused_times = init_4d_gaussian['t'].cuda() |
| 305 | print("Number of points at initialisation : ", fused_point_cloud.shape[0]) |
| 306 | |
| 307 | scales = init_4d_gaussian['scaling'].cuda() |
| 308 | rots = init_4d_gaussian['rotation'].cuda() |
| 309 | scales_t = init_4d_gaussian['scaling_t'].cuda() |
| 310 | rots_r = init_4d_gaussian['rotation_r'].cuda() |
| 311 | |
| 312 | opacities = init_4d_gaussian['opacity'].cuda() |
| 313 | |
| 314 | self._xyz = nn.Parameter(fused_point_cloud.requires_grad_(True)) |
| 315 | self._features_dc = nn.Parameter(features_dc.transpose(1, 2).requires_grad_(True)) |
| 316 | self._features_rest = nn.Parameter(features_rest.transpose(1, 2).requires_grad_(True)) |
| 317 | self._scaling = nn.Parameter(scales.requires_grad_(True)) |
| 318 | self._rotation = nn.Parameter(rots.requires_grad_(True)) |
| 319 | self._opacity = nn.Parameter(opacities.requires_grad_(True)) |
| 320 | self.max_radii2D = torch.zeros((self.get_xyz.shape[0]), device="cuda") |
| 321 | |
| 322 | self._t = nn.Parameter(fused_times.requires_grad_(True)) |
| 323 | self._scaling_t = nn.Parameter(scales_t.requires_grad_(True)) |
| 324 | self._rotation_r = nn.Parameter(rots_r.requires_grad_(True)) |
| 325 | |
| 326 | def training_setup(self, training_args): |
| 327 | self.percent_dense = training_args.percent_dense |