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

[ENH] consider adding test time augmentation #163

Open
kaczmarj opened this issue Jul 24, 2023 · 4 comments
Open

[ENH] consider adding test time augmentation #163

kaczmarj opened this issue Jul 24, 2023 · 4 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@kaczmarj
Copy link
Member

test time augmentation has the potential to improve model performance without any changes to the model parameters.

before implementing this, let's consider how best to implement it. i imagine the run_inference function can take a boolean argument tta or test_time_augmentation to enable this feature. if it is enabled, we would run the model on each patch multiple times (once for each transformation). the transformations must be rigid and must not rotate the images in non-90 degree increments.

transformations might include:

  • 90, 180, 270 degree rotations
  • horizontal or vertical flips
  • color changes? perhaps not.
@kaczmarj
Copy link
Member Author

@swaradgat19 - feel free to look into this as well.

@kaczmarj
Copy link
Member Author

kaczmarj commented Aug 4, 2023

@swaradgat19 - i suggest starting small and trying to get tta (test time aug) working on a single patch. we can work on incorporating this into the codebase later on.

the pytorch dataset class we use to read patches is defined here:

class WholeSlideImagePatches(torch.utils.data.Dataset):

i don't think that class will work for tta as it is written currently. you can create a new one for your needs. we can work on incorporating it into the codebase later on.

here's how tta would work:

  1. read the patch
  2. create augmented views of this patch (right-angle rotations, flips, color augs)
  3. run all of the views (including original) through the model
  4. average the model outputs across all of the views

@kaczmarj kaczmarj added the enhancement New feature or request label Sep 20, 2023
@kaczmarj kaczmarj added the help wanted Extra attention is needed label Feb 22, 2024
@kaczmarj kaczmarj changed the title consider adding test time augmentation [ENH] consider adding test time augmentation Feb 22, 2024
@swaradgat19
Copy link
Contributor

@kaczmarj Should I work on this feature? I am considering writing a separate script for transformations and then calling the function on each patch. What would you suggest?

@kaczmarj
Copy link
Member Author

kaczmarj commented Mar 5, 2024

hi @swaradgat19 - sorry this fell through the cracks of my email! yes, it would be great if you could work on this feature. for debugging and developing, writing a separate script to run transformations makes sense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants