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

Additional Satlas pretrained models #1884

Merged
merged 9 commits into from
Feb 21, 2024
Merged

Conversation

piperwolters
Copy link
Contributor

@piperwolters piperwolters commented Feb 15, 2024

Documentation, satellite-specific transforms, and weights for additional Satlas single-image RGB & multispectral Swin-v2 models. Tests pass.

Few things:

  • Renamed the existing model weights to include "SI", for single-image input. torchgeo doesn't support multi-image input yet, but there are multi-image Satlas models so hopefully someday those could be included.
  • There are a couple custom transforms, for Landsat and multispectral Sentinel-2. Maybe there's a cleaner way to do this?

@github-actions github-actions bot added documentation Improvements or additions to documentation models Models and pretrained weights labels Feb 15, 2024
…l Satlas single-image rgb&multispectral Swin-v2 models. Tests pass.
@piperwolters
Copy link
Contributor Author

@piperwolters please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="Allen Institute for AI"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

@piperwolters please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.

@microsoft-github-policy-service agree [company="Allen Institute for AI"]

Options:

  • (default - no company specified) I have sole ownership of intellectual property rights to my Submissions and I am not making Submissions in the course of work for my employer.
@microsoft-github-policy-service agree
  • (when company given) I am making Submissions in the course of work for my employer (or my employer has intellectual property rights in my Submissions by contract or applicable law). I have permission from my employer to make Submissions and enter into this Agreement on behalf of my employer. By signing below, the defined term “You” includes me and my employer.
@microsoft-github-policy-service agree company="Microsoft"

Contributor License Agreement

docs/api/naip_pretrained_weights.csv Outdated Show resolved Hide resolved
docs/api/sentinel1_pretrained_weights.csv Outdated Show resolved Hide resolved
torchgeo/models/swin.py Outdated Show resolved Hide resolved
torchgeo/models/swin.py Outdated Show resolved Hide resolved
torchgeo/models/swin.py Outdated Show resolved Hide resolved
torchgeo/models/swin.py Outdated Show resolved Hide resolved
torchgeo/models/swin.py Outdated Show resolved Hide resolved
@github-actions github-actions bot added the transforms Data augmentation transforms label Feb 20, 2024
@piperwolters
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Allen Institute for AI"

Copy link
Collaborator

@isaaccorley isaaccorley left a comment

Choose a reason for hiding this comment

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

Minor change but otherwise LGTM. @adamjstewart not sure if the CLA bot is broken or what's happening here

torchgeo/models/swin.py Outdated Show resolved Hide resolved
torchgeo/models/swin.py Show resolved Hide resolved
@piperwolters
Copy link
Contributor Author

@microsoft-github-policy-service agree company="Allen Institute for AI"

@calebrob6
Copy link
Member

Looks like that last one did it 🤷‍♂️

torchgeo/models/swin.py Outdated Show resolved Hide resolved
calebrob6
calebrob6 previously approved these changes Feb 21, 2024
@calebrob6 calebrob6 merged commit ad2ef7a into microsoft:main Feb 21, 2024
24 checks passed
@calebrob6
Copy link
Member

Thanks Piper!!

@piperwolters
Copy link
Contributor Author

Woohoo! Thank you guys

Swin_V2_B_Weights.NAIP_RGB_SI_SATLAS,3,`link <https://github.com/allenai/satlas>`__,`link <https://arxiv.org/abs/2211.15660>`__,"ODC-BY"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for correcting this license

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wait, but https://huggingface.co/allenai/satlas-pretrain has an Apache-2.0 license?

docs/api/sentinel2_pretrained_weights.csv Show resolved Hide resolved
torchgeo/models/swin.py Show resolved Hide resolved
torchgeo/models/swin.py Show resolved Hide resolved
torchgeo/models/swin.py Show resolved Hide resolved
torchgeo/models/swin.py Show resolved Hide resolved
torchgeo/transforms/transforms.py Show resolved Hide resolved
@adamjstewart adamjstewart added this to the 0.6.0 milestone Feb 22, 2024
@adamjstewart
Copy link
Collaborator

Another comment on this. Our unit tests do not actually attempt to download the model. We have separate tests for this that are only run before each release. If you run:

> pytest -m slow tests/models/test_swin.py

you'll see that these models fail due to:

RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device('cpu') to map your storages to the CPU.

We should either change the weights to be for the CPU (this is what we did for all other model weights in TorchGeo) or set the map_location for all models.

@adamjstewart
Copy link
Collaborator

Also see #1916, I'm changing the URLs for all of our models to ensure that the md5 is reproducible even if you make this kind of change.

GeorgeHuber pushed a commit to GeorgeHuber/torchgeo that referenced this pull request Feb 28, 2024
* Documentation, satellite-specific transform and weights for additional Satlas single-image rgb&multispectral Swin-v2 models. Tests pass.

* Address 3 of comments

* Address comments, fix readmydocs and isort, mypy still unhappy

* update

* Add bands to meta dicts

* Add comment about Satlas S2 RGB using TCI product

* linting

---------

Co-authored-by: Piper Wolters <piperw@allenai.org>
Co-authored-by: Piper Wolters <piperw@prior-cirrascale-79.reviz.ai2.in>
adamjstewart added a commit that referenced this pull request Mar 15, 2024
* initial commit

* add init description

* correct scanning of files in init

* added random data generation

* remove test directory

* Update metadata

* fix formatting

* add s1 data and update regex

* fix dataset and add tests

* formatting

* mypy

* add timeseries test and take images from july

* fix bug in merging files across dates

* mypy

* Bump lightly from 1.4.25 to 1.5.0 in /requirements (#1894)

* Additional Satlas pretrained models (#1884)

* Documentation, satellite-specific transform and weights for additional Satlas single-image rgb&multispectral Swin-v2 models. Tests pass.

* Address 3 of comments

* Address comments, fix readmydocs and isort, mypy still unhappy

* update

* Add bands to meta dicts

* Add comment about Satlas S2 RGB using TCI product

* linting

---------

Co-authored-by: Piper Wolters <piperw@allenai.org>
Co-authored-by: Piper Wolters <piperw@prior-cirrascale-79.reviz.ai2.in>

* Update tests/data/south_africa_crop_type/data.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update tests/data/south_africa_crop_type/data.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update torchgeo/datasets/south_africa_crop_type.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update torchgeo/datasets/south_africa_crop_type.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update torchgeo/datasets/south_africa_crop_type.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update torchgeo/datasets/south_africa_crop_type.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* refactor gettitem and bug fixes

* typo

* data.py style

* Update torchgeo/datasets/south_africa_crop_type.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update torchgeo/datasets/south_africa_crop_type.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* added comments for nonstandard functionality

* Update torchgeo/datasets/south_africa_crop_type.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* small change

* add verbose documentation

---------

Co-authored-by: georgehuber <“georgehuber8@gmail.com”>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Piper Wolters <46272042+piperwolters@users.noreply.github.com>
Co-authored-by: Piper Wolters <piperw@allenai.org>
Co-authored-by: Piper Wolters <piperw@prior-cirrascale-79.reviz.ai2.in>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
@adamjstewart
Copy link
Collaborator

@piperwolters did you ever get a chance to apply the change requests here?

@adamjstewart
Copy link
Collaborator

Soft reminder @piperwolters 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation models Models and pretrained weights transforms Data augmentation transforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants