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

OSCDDataModule not compatible with SemanticSegmentationTask #336

Closed
adamjstewart opened this issue Dec 30, 2021 · 1 comment · Fixed by #992
Closed

OSCDDataModule not compatible with SemanticSegmentationTask #336

adamjstewart opened this issue Dec 30, 2021 · 1 comment · Fixed by #992
Labels
datamodules PyTorch Lightning datamodules trainers PyTorch Lightning trainers

Comments

@adamjstewart
Copy link
Collaborator

adamjstewart commented Dec 30, 2021

OSCD is a change detection dataset. OSCDDataset.__getitem__ returns an "image" of shape [2 x C x H x W]. Most of our other datasets return images of shape [C x H x W], and SemanticSegmentationTask is designed to work with these kind of images. It looks like there are some hacks in OSCDDataModule to work around this, but these hacks are very unreliable. For example, in:

mask = repeat(sample["mask"], "h w -> t h w", t=2).float()               
image, mask = self.rcrop(sample["image"], mask)                          
mask = mask.squeeze()[0]                                                 
images.append(image.squeeze())                                           
masks.append(mask.long())         

we use squeeze() without specifying which dimension to remove. This has different behavior when batch size is 1 vs >1, so we should avoid using this.

To fix this, I think we could either change __getitem__ to return an "image" of shape [2C x H x W] or create a new ChangeDetectionTask for these kinds of datasets.

See the following comments for additional discussion/issues:

@adamjstewart adamjstewart added trainers PyTorch Lightning trainers datamodules PyTorch Lightning datamodules labels Dec 30, 2021
@ngonthier
Copy link

I am interested in having a ChangeDetectionTask for these kinds of datasets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datamodules PyTorch Lightning datamodules trainers PyTorch Lightning trainers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants