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

datamodules: Switch to kornia AugmentationSequential #2147

Merged
merged 21 commits into from
Nov 6, 2024

Conversation

ashnair1
Copy link
Collaborator

@ashnair1 ashnair1 commented Jul 1, 2024

Switch to kornia's AugmentationSequential in datamodules submodule

Closes #1432

TODO (once kornia 0.7.4 is released):

  • Remove manual setting of keepdim attribute
  • Bump min version of kornia

@github-actions github-actions bot added testing Continuous integration testing datamodules PyTorch Lightning datamodules datasets Geospatial or benchmark datasets labels Jul 1, 2024
torchgeo/datasets/cyclone.py Outdated Show resolved Hide resolved
@adamjstewart adamjstewart added this to the 0.6.0 milestone Jul 1, 2024
@github-actions github-actions bot added the trainers PyTorch Lightning trainers label Jul 1, 2024
@ashnair1
Copy link
Collaborator Author

ashnair1 commented Jul 2, 2024

TODO: Tutorials need to be updated once we fully switch to kornia's AugmentationSequential

@ashnair1 ashnair1 marked this pull request as ready for review July 2, 2024 07:23
@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch from 5c37d97 to c40d8bc Compare July 2, 2024 09:37
.pre-commit-config.yaml Outdated Show resolved Hide resolved
torchgeo/datamodules/inria.py Outdated Show resolved Hide resolved
@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch from c40d8bc to a0376b8 Compare July 2, 2024 15:42
@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch from a738549 to d43baf2 Compare July 14, 2024 17:10
@github-actions github-actions bot removed the trainers PyTorch Lightning trainers label Jul 14, 2024
@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch 4 times, most recently from 5fb90fb to c7ce4f7 Compare July 14, 2024 19:55
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.

Still confused by some of the dataset changes, but all datamodule changes now look good. I'll see if I can figure out why the tests are failing.

torchgeo/datasets/cyclone.py Outdated Show resolved Hide resolved
torchgeo/datasets/inria.py Outdated Show resolved Hide resolved
@adamjstewart
Copy link
Collaborator

But tests are failing for most GeoDataModules.

I wish it were this simple... Note that some failing tests are for NonGeoDataModules (ssl4eo_l_benchmark_*).

Also note that some tests fail depending on batch size. For example, gid15 passes with batch_size=1, but fails if batch_size=2. But there are other datasets for which both 1 and 2+ pass. For the case of gid15, it seems like this is because the image is 1x1, so this may be a red herring.

Most of the failing tests seem to be because the ground truth mask has a channel dimension, which cross-entropy loss does not like. Let me see if I can fix a few.

@adamjstewart adamjstewart added the backwards-incompatible Changes that are not backwards compatible label Jul 18, 2024
@adamjstewart
Copy link
Collaborator

The ChesapeakeCVPR dataset is royally screwed up and I'm not touching it, so I'll let you or @calebrob6 solve that one. The problem is that it doesn't use RasterDataset and the mask is sometimes single channel, sometimes multichannel, so you have to be very careful with all dimensions. I'm not even sure our trainer supports multichannel masks.

@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch 2 times, most recently from 7e14613 to d2b5b01 Compare July 20, 2024 13:16
@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch 3 times, most recently from b19be82 to 919bbb2 Compare August 9, 2024 15:20
@adamjstewart
Copy link
Collaborator

Is this waiting on Kornia 0.7.4? Trying to decide if this should be in TorchGeo 0.6.0 next week or if we should bump it to a later release.

@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch from 85e91bc to e34e120 Compare November 5, 2024 18:25
@robmarkcole
Copy link
Contributor

Kornia 0.7.4. is out :-)

@adamjstewart
Copy link
Collaborator

Yep, reviewing this now...

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.

This looks really clean now, thanks for all the hard work on this!

I think the only other place we use our wrapper is in the transforms tutorial? Maybe we can remove that in a separate PR so we don't hold this up.

pyproject.toml Outdated Show resolved Hide resolved
tests/datasets/test_chesapeake.py Show resolved Hide resolved
@ashnair1 ashnair1 force-pushed the aug-remove-datamodules branch from e34e120 to 151c343 Compare November 6, 2024 15:37
@github-actions github-actions bot added the documentation Improvements or additions to documentation label Nov 6, 2024
@adamjstewart adamjstewart merged commit 69f0c70 into microsoft:main Nov 6, 2024
20 checks passed
@ashnair1 ashnair1 deleted the aug-remove-datamodules branch November 6, 2024 17:27
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 dependencies Packaging and dependencies documentation Improvements or additions to documentation testing Continuous integration testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

USAVars Augmentation maps to 0
3 participants