-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Floater removal tool for splatfacto #3001
base: main
Are you sure you want to change the base?
Floater removal tool for splatfacto #3001
Conversation
nerfstudio/models/splatfacto.py
Outdated
@@ -393,7 +503,10 @@ def after_train(self, step: int): | |||
with torch.no_grad(): | |||
# keep track of a moving average of grad norms | |||
visible_mask = (self.radii > 0).flatten() | |||
assert self.xys.grad is not None | |||
try: |
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.
change to if self.xys.grad is None: return
# Create the button with the modified callback | ||
self.button2 = ViewerButton("Delete Gaussians", cb_hook=delete_cropbox) | ||
|
||
def select_gaussians(button: ViewerButton): |
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.
Can we make both select_gaussians
and delete_cropbox
class functions? Will declutter the populate modules function
nerfstudio/models/splatfacto.py
Outdated
self.selected_gaussian_indices = [] | ||
self.original_colors = None | ||
|
||
def update_colors(self): |
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 this function is self-contained enough that it can be defined inside on_select
, that way its scope is clearer (it only gets used inside that callback).
nerfstudio/models/splatfacto.py
Outdated
@@ -186,6 +186,29 @@ def __init__( | |||
): | |||
self.seed_points = seed_points | |||
super().__init__(*args, **kwargs) | |||
self.selected_gaussian_indices = [] |
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.
Let's define these inside populate_submodules
next to the buttons/viewer control so all the new code for initializing floater removal is in one place
camera = camera.to(self.device) | ||
|
||
self.eval() | ||
self.get_outputs_for_camera(camera) |
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.
can surround this in a with torch.no_grad()
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.
done! :D
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.
Oh i meant the get_outputs_for_camera() line
Hi! Thanks for your contribution! Any chance the changes will make it (PR)? |
Any updates on this PR? I tried to use ViewerRectSelect instead of ViewerDragbox and I can't get the right bounds |
Given this diff from Discord: https://www.diffchecker.com/N9KpBfmc/ One thing to check is perhaps the way But these lines: box_min[0] = image_dim[0] // 2 * box_min[0] + image_dim[0] // 2
box_max[0] = image_dim[0] // 2 * box_max[0] + image_dim[0] // 2
box_min[1] = image_dim[1] // 2 * box_min[1] + image_dim[1] // 2
box_max[1] = image_dim[1] // 2 * box_max[1] + image_dim[1] // 2 appear to imply they're in [-1, 1]. |
Hi Brent!
Oh, do you have any suggestions on how to fix this? I'm not sure how it can
get in the range of [-1, 1]. Should I do a max function of (0, and
box_min[0]) etc to make sure it's in the range [0,1]?
Best,
Annie
…On Wed, Jul 10, 2024 at 7:05 PM Brent Yi ***@***.***> wrote:
Any updates on this PR? I tried to use ViewerRectSelect instead of
ViewerDragbox and I can't get the right bounds
Given this diff from Discord: https://www.diffchecker.com/N9KpBfmc/
One thing to check is perhaps the way min_bounds and max_bounds are used?
The docs on the merged version of ViewerRectSelect seem to say they're in
[0, 1]:
https://docs.nerf.studio/reference/api/viewer.html#nerfstudio.viewer.viewer_elements.ViewerRectSelect
But these lines:
box_min[0] = image_dim[0] // 2 * box_min[0] + image_dim[0] // 2
box_max[0] = image_dim[0] // 2 * box_max[0] + image_dim[0] // 2
box_min[1] = image_dim[1] // 2 * box_min[1] + image_dim[1] // 2
box_max[1] = image_dim[1] // 2 * box_max[1] + image_dim[1] // 2
appear to imply they're in [-1, 1].
—
Reply to this email directly, view it on GitHub
<#3001 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AQFHXHG2YLL6XSXWLSM4RR3ZLW4ZZAVCNFSM6AAAAABEXA4AE2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRRGY3DQOBWGM>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
No description provided.