-
Notifications
You must be signed in to change notification settings - Fork 334
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
base: main
Are you sure you want to change the base?
Conversation
TODO: Tutorials need to be updated once we fully switch to kornia's |
5c37d97
to
c40d8bc
Compare
c40d8bc
to
a0376b8
Compare
a738549
to
d43baf2
Compare
5fb90fb
to
c7ce4f7
Compare
There was a problem hiding this 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.
|
||
if self.transforms is not None: | ||
sample = self.transforms(sample) | ||
sample.update({x: features[x] for x in features if x != 'label'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit confused by this. Relative time and ocean are not returned if transforms is None? This PR only touches datamodule augmentations, not dataset transforms, right? Why is this needed? Same question for all other datasets.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reason for this mentioned here- #2147 (comment)
These type of fixes won't be required once kornia/kornia#2971 makes it to a release. It allows non-kornia compatible keys to be passed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this kind of seems like a hack. It's an implementation detail that TropicalCycloneDataModule
doesn't use TropicalCyclone(..., transform=...)
, not by design. I definitely don't think we should return different things depending on whether transforms
is used or not.
I have a better idea. In BaseDataModule
in transfer_batch_to_device
, drop all keys that Kornia doesn't recognize. This will allow us to drop most changes to datasets and the transfer_batch_to_device
in GeoDataModule
. You can loop over all keys and drop any that don't correspond to a valid Kornia key (there should be a way to get a list of valid keys from Kornia).
@@ -217,7 +217,10 @@ def plot( | |||
show_predictions = 'prediction' in sample | |||
|
|||
if show_mask: | |||
mask = sample['mask'].numpy() | |||
mask = sample['mask'] | |||
if mask.ndim == 3 and mask.shape[0] == 1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the mask occasionally change dimensions? Maybe this can be made uniform in getitem?
I wish it were this simple... Note that some failing tests are for NonGeoDataModules ( Also note that some tests fail depending on batch size. For example, 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. |
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. |
7e14613
to
d2b5b01
Compare
b19be82
to
919bbb2
Compare
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. |
Later release for sure. This does depend on Kornia 0.7.4. |
5f52a49
to
d6853bf
Compare
d6853bf
to
2ad6222
Compare
2ad6222
to
843a596
Compare
Switch to kornia's
AugmentationSequential
indatamodules
submoduleCloses #1432
TODO (once kornia 0.7.4 is released):