maincold2/Compact-3DGS

Question about the calculation of the size of model without masking, color representation, geometry codebook.

Opened this issue · 2 comments

Thanks for your great work!
Table5 show the storage of 3DGS.
image
I have read the code about calculation of model size
` def final_prune(self, compress=False):
prune_mask = (torch.sigmoid(self._mask) <= 0.01).squeeze()
self.prune_points(prune_mask)

    for m in self.vq_scale.layers:
        m.training = False
    for m in self.vq_rot.layers: 
        m.training = False

    self._xyz = self._xyz.clone().half().float()
    self._scaling, self.sca_idx, _ = self.vq_scale(self.get_scaling.unsqueeze(1))
    self._rotation, self.rot_idx, _ = self.vq_rot(self.get_rotation.unsqueeze(1))
    self._scaling = self._scaling.squeeze()
    self._rotation = self._rotation.squeeze()

    position_mb = self._xyz.shape[0]*3*16/8/10**6
    scale_mb = self._xyz.shape[0]*self.rvq_bit*self.rvq_num/8/10**6 + 2**self.rvq_bit*self.rvq_num*3*32/8/10**6
    rotation_mb = self._xyz.shape[0]*self.rvq_bit*self.rvq_num/8/10**6 + 2**self.rvq_bit*self.rvq_num*4*32/8/10**6
    opacity_mb = self._xyz.shape[0]*16/8/10**6
    hash_mb = self.recolor.params.shape[0]*16/8/10**6
    mlp_mb = self.mlp_head.params.shape[0]*16/8/10**6
    sum_mb = position_mb+scale_mb+rotation_mb+opacity_mb+hash_mb+mlp_mb
    
    mb_str = "Storage\nposition: "+str(position_mb)+"\nscale: "+str(scale_mb)+"\nrotation: "+str(rotation_mb)+"\nopacity: "+str(opacity_mb)+"\nhash: "+str(hash_mb)+"\nmlp: "+str(mlp_mb)+"\ntotal: "+str(sum_mb)+" MB"`

If i want to separately calculate the storage of Pos. , Opa. , Sca. , Rot. , Col. like in table5 3DGS , i modify the code as follow,but i am not sure whether it is right :
position_mb = self._xyz.shape[0]*3*16/8/10**6

scale_mb = self._xyz.shape[0]*3*16/8/10**6

rotation_mb = self._xyz.shape[0]**4*16/8/10**6

opacity_mb = self._xyz.shape[0]*16/8/10**6
Besides, i don't know the exact calculation of the color storage. Coulud you please tell me how to calculate the color storage without masking, color representation, geometry codebook.?
Looking forward your reply !

3DGS originally used 32-bit floating tensor, so you would multiply 32 rather than 16 (e.g., position_mb = self._xyz.shape[0]*32/8/10**6).
For color, 3DGS requires 48 parameters for spherical harmonics, so you can calculate as self._xyz.shape[0]*48*32/8/10**6.

Thanks!

Thanks for your reply!