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

Importance Sampling #2172

Closed
pavan-tummala-tcgls opened this issue May 9, 2024 · 3 comments
Closed

Importance Sampling #2172

pavan-tummala-tcgls opened this issue May 9, 2024 · 3 comments
Assignees

Comments

@pavan-tummala-tcgls
Copy link

pavan-tummala-tcgls commented May 9, 2024

Hello,

I had a question on how I could improve the performance of nnUNet on certain kind of training data or weigh them more in general during training so I was wondering if I could assign higher weights so instead of sampling uniformly from the training dataset, it can use the assigned weights to sample more frequently from important examples.

Thank You.

@ZxnSnowy
Copy link

I have the same problem, like there are 200 image.nii.gz, 50 of which I want one or more to appear in the batch every time. How should I deal with it?

@GregorKoehler
Copy link

Hi @pavan-tummala-tcgls and @ZxnSnowy,
as far as I can tell, nnUNet does not offer configuration options to oversample certain samples out of the box. So I'd propose you implement your own DataLoader class which implements this. Take a look at the classes in: https://github.com/MIC-DKFZ/nnUNet/tree/master/nnunetv2/training/dataloading
As a pointer, the best choice is to adapt the get_indices method. Here's the default get_indices method in batchgenerators' DataLoader class, from which the nnUNet DataLoaders inherit:
https://github.com/MIC-DKFZ/batchgenerators/blob/f53025bd05fe9642133ac539a0df3559d82415b4/batchgenerators/dataloading/data_loader.py#L185-L213

@pavan-tummala-tcgls
Copy link
Author

Thanks for the info. Will try this out.

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

No branches or pull requests

3 participants