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

Remove AugPipe #1978

Merged
merged 12 commits into from
Feb 8, 2025
Merged

Remove AugPipe #1978

merged 12 commits into from
Feb 8, 2025

Conversation

ashnair1
Copy link
Collaborator

@ashnair1 ashnair1 commented Apr 3, 2024

The next version of kornia (0.7.3) will contain 2 fixes (kornia/kornia#2846, kornia/kornia#2856) that will allow us to drop AugPipe and have detection only depend on kornia's AugmentationSequential.

@github-actions github-actions bot added datasets Geospatial or benchmark datasets testing Continuous integration testing trainers PyTorch Lightning trainers datamodules PyTorch Lightning datamodules labels Apr 3, 2024
@adamjstewart
Copy link
Collaborator

How close are we to also removing our custom AugmentationSequential wrapper?

@ashnair1
Copy link
Collaborator Author

ashnair1 commented Apr 3, 2024

How close are we to also removing our custom AugmentationSequential wrapper?

Pretty close actually. If kornia==0.7.3 is released soon, we should be able to fully remove it by next release.

@robmarkcole
Copy link
Contributor

@adamjstewart
Copy link
Collaborator

@ashnair1 is this waiting on kornia 0.7.4 for something?

@ashnair1
Copy link
Collaborator Author

Yeah #2147 needs to be merged before this and that needs kornia 0.7.4.

@adamjstewart adamjstewart modified the milestones: 0.6.0, 0.7.0 Aug 21, 2024
@robmarkcole
Copy link
Contributor

Note: 0.7.4 will be released by the end of September

@ashnair1 ashnair1 force-pushed the aug-remove branch 3 times, most recently from 2d281ce to d60d6fb Compare November 9, 2024 19:09
@calebrob6
Copy link
Member

This is good to go forward now

@adamjstewart
Copy link
Collaborator

adamjstewart commented Dec 27, 2024

Drop in coverage is due to some lines in our AugmentationSequential wrapper that are no longer hit. Can we just delete this wrapper now, or are we using it somewhere else? Ideally we would add some simple tests and deprecate it so as not to confuse too many people in the next release.

@github-actions github-actions bot added the transforms Data augmentation transforms label Dec 27, 2024
@ashnair1
Copy link
Collaborator Author

ashnair1 commented Dec 27, 2024

Drop in coverage is due to some lines in our AugmentationSequential wrapper that are no longer hit. Can we just delete this wrapper now, or are we using it somewhere else? Ideally we would add some simple tests and deprecate it so as not to confuse too many people in the next release.

No, the AugmentationSequential wrapper can be removed in this PR. I just needed to update tests to see if they were working as expected.

Have removed _ExtractPatches since kornia's ExtractTensorPatches works just as well.

@ashnair1 ashnair1 changed the title Remove AugPipe Remove AugPipe and AugmentationSequential wrapper Dec 27, 2024
@adamjstewart
Copy link
Collaborator

Alternatively, convert our AugmentationSequential to an alias of Kornia's so you don't need to add any tests. Or I can do that in my PR, but my PR can't be merged without this PR.

@ashnair1
Copy link
Collaborator Author

ashnair1 commented Jan 6, 2025

Making our AugmentationSequential an alias for kornia's won't work as _ExtractPatches won't work with it. It would have to be removed. Refer to #1978 (comment).

@adamjstewart
Copy link
Collaborator

Ah right. So we have to figure out how to fix or replace _ExtractPatches before either of our PRs can be merged 😢

@adamjstewart
Copy link
Collaborator

_ExtractPatches doesn't work correctly with kornia's AugmentationSequential.

Can you clarify this? I can hack this to work. Would like to push forward on this PR, either by adding more tests or fixing compatibility.

@ashnair1
Copy link
Collaborator Author

ashnair1 commented Feb 5, 2025

_ExtractPatches doesn't work correctly with kornia's AugmentationSequential.

Can you clarify this? I can hack this to work. Would like to push forward on this PR, either by adding more tests or fixing compatibility.

Turns out the test was incorrect. Our AugmentationSequential was changing the input batch itself and that's what we were testing. This PR should be good to go now. Though there does seem to be an issue with keepdim not being acknowledged correctly.

@adamjstewart
Copy link
Collaborator

Drop in coverage is for our AugmentationSequential. In torchgeo/transforms/transforms.py, can you replace our AugmentationSequential with:

from kornia.augmentation import AugmentationSequential

# Only include import redirects
__all__ = ('AugmentationSequential',)

I'll figure out the deprecation stuff in another PR.

@adamjstewart
Copy link
Collaborator

Well this is funny. The documentation tests are failing because it's trying to document Kornia's AugmentationSequential but we're missing an image file. In docs/api/transforms.rst, let's use:

.. automodule:: torchgeo.transforms
   :exclude-members: AugmentationSequential

@github-actions github-actions bot added documentation Improvements or additions to documentation transforms Data augmentation transforms labels Feb 6, 2025
Copy link
Collaborator

@adamjstewart adamjstewart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again for all your work on wrangling the sample dicts to have a consistent format! I'll start work on deprecation and type hints.

@adamjstewart adamjstewart dismissed isaaccorley’s stale review February 8, 2025 10:15

Tests have been updated

@adamjstewart adamjstewart merged commit b9404d1 into microsoft:main Feb 8, 2025
22 checks passed
@ashnair1 ashnair1 deleted the aug-remove branch February 8, 2025 11:01
@adamjstewart adamjstewart mentioned this pull request Feb 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards-incompatible Changes that are not backwards compatible datamodules PyTorch Lightning datamodules datasets Geospatial or benchmark datasets documentation Improvements or additions to documentation testing Continuous integration testing trainers PyTorch Lightning trainers transforms Data augmentation transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants