instant-nsr-pl icon indicating copy to clipboard operation
instant-nsr-pl copied to clipboard

Question about nerfacc for Unbounded Scene

Open finninmunich opened this issue 2 years ago • 4 comments

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!

finninmunich avatar Feb 20 '23 15:02 finninmunich

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 avatar Feb 21 '23 06:02 bennyguo

@bennyguo Hi, Can Neus support unbounded Scene?

xuxumiao777 avatar Feb 27 '23 00:02 xuxumiao777

@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 avatar Feb 27 '23 10:02 bennyguo

@bennyguo great!!! ^^

xuxumiao777 avatar Feb 27 '23 15:02 xuxumiao777