stable-dreamfusion
stable-dreamfusion copied to clipboard
About init_tet function of DMTet
Can you explain init_tet()
for initializing DMTet?
As far as I understand, with SDF, the part where the SDF value is 0 becomes the surface.
I wonder if self.sdf.data += (sigma - density.thresh).clamp(-1, 1)
means to set the density corresponding to the density_thresh value as surface.
(Since self.sdf is initialized to zero at the beginning, and sigma predicts only positive,
I understood that it means to set values corresponding to density_thresh as the surface in sigma.)
And I wonder why the density_thresh is multiplied by 25 if the density_activation is softplus. Can you tell me what 25 numbers mean?
@torch.no_grad()
def init_tet(self):
if self.cuda_ray:
density_thresh = min(self.mean_density, self.density_thresh)
else:
density_thresh = self.density_thresh
if self.opt.density_activation == 'softplus':
density_thresh = density_thresh * 25
# init scale
sigma = self.density(self.verts)['sigma'] # verts covers [-1, 1] now
mask = sigma > density_thresh
valid_verts = self.verts[mask]
self.tet_scale = valid_verts.abs().amax(dim=0) + 1e-1
self.verts = self.verts * self.tet_scale
# init sigma
sigma = self.density(self.verts)['sigma'] # new verts
self.sdf.data += (sigma - density_thresh).clamp(-1, 1)
print(f'[INFO] init dmtet: scale = {self.tet_scale}')
@ug-kim Hi, you are right. 25 is simply an empirical scale for softplus
activation, to make the surface more accurate.