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

Datamodule for SpaceNet1 #965

Merged
merged 12 commits into from
Dec 24, 2022
Merged

Datamodule for SpaceNet1 #965

merged 12 commits into from
Dec 24, 2022

Conversation

calebrob6
Copy link
Member

Some things to note:

  • SpaceNet1 patches are (406, 438) so I zero-pad to 448 x 448
  • I add one to the mask layer in preprocessing so the classes are {nodata, background, building}
  • I ignore the 0 class (the value that gets added due to padding) in the train config
  • I changed SpaceNet's data.py to generate 3 samples by default so that we can test train/val/test (@ashnair1)

I can confirm that this is working with train.py, here's a shot from TensorBoard

image

@github-actions github-actions bot added datamodules PyTorch Lightning datamodules documentation Improvements or additions to documentation scripts Training and evaluation scripts testing Continuous integration testing labels Dec 20, 2022
tests/datamodules/test_spacenet.py Outdated Show resolved Hide resolved
train.py Outdated Show resolved Hide resolved
@adamjstewart
Copy link
Collaborator

SpaceNet1 patches are (406, 438) so I zero-pad to 448 x 448

I'm guessing U-Nets require 1) square patches, and 2) patch sizes that are multiples of 32?

@adamjstewart adamjstewart added this to the 0.4.0 milestone Dec 20, 2022
@calebrob6
Copy link
Member Author

I'm guessing U-Nets require 1) square patches, and 2) patch sizes that are multiples of 32?

They just need patch sizes that are multiples of 32. There are 5 downsampling operations by default (going down the left side of the "U") which reduces the spatial resolution of the input by a factor of 32. If the input isn't evenly divisible by 32, then there will be some rounding, and in the upsample part of the "U", the spatial dimensions of the features in the skip connections won't match.

@calebrob6
Copy link
Member Author

This is good to go pending the question in the above comment about larger test images vs. epsilon in the percentile normalization.

torchgeo/datamodules/spacenet.py Show resolved Hide resolved
tests/data/spacenet/data.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the datasets Geospatial or benchmark datasets label Dec 21, 2022
@adamjstewart adamjstewart enabled auto-merge (squash) December 24, 2022 02:52
@adamjstewart adamjstewart merged commit 0a44f9a into main Dec 24, 2022
@adamjstewart adamjstewart deleted the datamodule-spacenet1 branch December 24, 2022 03:02
yichiac pushed a commit to yichiac/torchgeo that referenced this pull request Apr 29, 2023
* Add SpaceNet1 datamodule

* Running black and isort

* version added

* Fix docs

* SpaceNet1 tests

* Testing spacenet datamodule with trainers

* no loveda

* black

* doc fix

* Removing direct datamodule test

* Make sure percent normalization doesn't divide by zero

* Speed up preprocessing

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datamodules PyTorch Lightning datamodules datasets Geospatial or benchmark datasets documentation Improvements or additions to documentation scripts Training and evaluation scripts testing Continuous integration testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants