Skip to content
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

fix pixel sampling with masks issue when data is list #2369

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

anc2001
Copy link
Contributor

@anc2001 anc2001 commented Aug 24, 2023

PixelSampler sample_method expects mask argument to be batched but mask is unbatched when the images / masks are given as list. Batches the mask in this case.

@anc2001
Copy link
Contributor Author

anc2001 commented Aug 31, 2023

For more context, when training on a dataset with images and masks of different sizes I get the following the following error

  File "/src/external/nerfstudio/nerfstudio/data/pixel_samplers.py", line 222, in collate_image_dataset_batch_list
    all_images.append(batch["image"][i][indices[:, 1], indices[:, 2]])
IndexError: index 2 is out of bounds for dimension 1 with size 2

This is because the expected shape from sample_method is [batch_size, 3] but in this case the returned indices are of shape [batch_size, 2]. Batching the mask fixes this error

@drewgilliam
Copy link
Contributor

@brentyi & @tancik - hoping you could help here since you've merged some of my recent PRs. Is there more information or more changes needed to get this PR merged? Thanks!

@brentyi
Copy link
Collaborator

brentyi commented Sep 14, 2023

Thanks for the ping @drewgilliam and the fix @anc2001; I just checked and this makes sense to me!

@brentyi brentyi enabled auto-merge (squash) September 14, 2023 15:58
@brentyi brentyi merged commit 805e6e7 into nerfstudio-project:main Sep 14, 2023
4 checks passed
@drewgilliam
Copy link
Contributor

@brentyi - thanks for the assist, much appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants