-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update forward & backward for rendered alpha image #70
Conversation
gsplat/rasterize.py
Outdated
background.contiguous().cuda(), | ||
final_Ts.contiguous().cuda(), | ||
final_idx.contiguous().cuda(), | ||
v_out_img.contiguous().cuda(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think ruilong removed the cuda() for these, could you take them out too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed but should .cuda()s still be in NDRasterize backwards?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the late review! this looks great, can we add an optional flag to the rasterize forward function called return_alpha
that defaults to False for backward compatibility though? After that change it looks good to merge
@Zhuoyang-Pan any ideas how this could be used with an input dataset that does contain masks to automatically segment the masked regions out? |
I am thinking of adding a L1 mask loss if the input dataset contains mask, but let me finish this PR first :) |
ec8b484
to
c9e4b98
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, thanks!
I added the forward and backward for rendered alpha image. This could be helpful if we want to train on datasets with masks/RGBA images.
Specifically, for each call of$\alpha$ gradient for each gaussian, I calculate it as
RasterizeGaussians.apply
orNDRasterizeGaussians.apply
now we would have two outputsout_img
(H * W * 3) andout_alpha
(H * W). Forwhere$C_i$ , $A_i$ are output colors, alpha respectively, $K$ is the number of channels of colors. The documents are also updated for reference of function calls.
I've also tested on following image where the left part has alpha=0.5 and the right part has alpha=1.
