Seeking clarification on a code snippet in synthesizer.py
Closed this issue · 1 comments
Hello 3DTopia,
I hope this message finds you well. I am a user of the OpenLRM repository and while exploring the code, I came across a specific line that I'm struggling to comprehend. The code snippet in question can be found at this link: link to the code snippet.
The line I'm referring to is:
rgb = torch.sigmoid(x[..., 1:])(1 + 2*0.001) - 0.001 # Utilizes sigmoid clamping from MipNeRF
I would greatly appreciate it if you could provide some clarification on its intended meaning and functionality. Specifically, I would like to understand how the sigmoid clamping from MipNeRF is being utilized to affect the RGB values.
Thank you for taking the time to help me understand this code better. I eagerly await your response.
I found out the meaning by reviewing mip-nerf's article:
Instead of a sigmoid to produce color c, we use a “widened” sigmoid that saturates slightly outside of [0, 1] (the range of input RGB intensities): (1 + 2ϵ)/(1 + exp(−x)) − ϵ, with ϵ = 0.001. This avoids an uncommon failure mode in which training tries to explain away a black or white pixel by saturating network activations into the tails of the sig�moid where the gradient is zero, which may cause optimization to fail.