instant-nsr-pl
instant-nsr-pl copied to clipboard
Question about nerfacc for Unbounded Scene
def contract_to_unisphere(x, radius, contraction_type):
if contraction_type == ContractionType.AABB:
x = scale_anything(x, (-radius, radius), (0, 1))
elif contraction_type == ContractionType.UN_BOUNDED_SPHERE:
x = scale_anything(x, (-radius, radius), (0, 1))
x = x * 2 - 1 # aabb is at [-1, 1]
mag = x.norm(dim=-1, keepdim=True)
mask = mag.squeeze(-1) > 1
x[mask] = (2 - 1 / mag[mask]) * (x[mask] / mag[mask])
x = x / 4 + 0.5 # [-inf, inf] is at [0, 1]
else:
raise NotImplementedError
return x
I don't know why you implemented a x = x / 4 + 0.5 # [-inf, inf] is at [0, 1]
here, could you explain it a little bit :)
Thank you!
Hi! Note that by doing
x = scale_anything(x, (-radius, radius), (0, 1))
x = x * 2 - 1
mag = x.norm(dim=-1, keepdim=True)
mask = mag.squeeze(-1) > 1
x[mask] = (2 - 1 / mag[mask]) * (x[mask] / mag[mask])
we map the bounding sphere (-radius, radius)
to (-1, 1)
and map the whole space (-inf, inf)
to (-2, 2)
. By taking x = x / 4 + 0.5
we map (-2, 2)
to (0, 1)
to be fed into the network.
@bennyguo Hi, Can Neus support unbounded Scene?
@xuxumiao777 I've just pushed a new branch that supports NeuS training with a background model. I'll merge this branch to the main branch after more tests on different scenes :)
@bennyguo great!!! ^^