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

Add Consistent bands Metadata to Vision Transformer and ResNet Weights #2376

Merged

Conversation

InderParmar
Copy link
Contributor

@InderParmar InderParmar commented Oct 29, 2024

This PR introduces consistent bands metadata across vit.py and resnet.py weight classes to enhance usability and ensure alignment with existing metadata standards in the project.

Changes to vit.py

  • Added bands metadata for Vision Transformer (ViT) weight classes.
  • Updated vit.py to import _satlas_bands, _satlas_sentinel2_bands, and _satlas_landsat_bands from swin.py for consistent band definitions.
  • Applied correct band metadata for each ViT weight class, supporting Landsat and Sentinel datasets, ensuring metadata aligns with project standards.

Changes to resnet.py

  • Added bands metadata for ResNet weight classes, providing consistent metadata across ResNet weights.
  • Updated resnet.py to import _satlas_bands, _satlas_sentinel2_bands, and _satlas_landsat_bands from swin.py.
  • Updated metadata fields to align with the Sentinel and Landsat dataset specifications, improving compatibility and usability for model users.
    Fixes Missing Band information for pretrained weights #2364

@github-actions github-actions bot added the models Models and pretrained weights label Oct 29, 2024
@InderParmar InderParmar changed the title Add Consistent bands Metadata to Vision Transformer and ResNet Weights Fixes #2364 Add Consistent bands Metadata to Vision Transformer and ResNet Weights Oct 29, 2024
@InderParmar InderParmar changed the title Fixes #2364 Add Consistent bands Metadata to Vision Transformer and ResNet Weights Fixes #2364: Add Consistent bands Metadata to Vision Transformer and ResNet Weights Oct 29, 2024
@InderParmar
Copy link
Contributor Author

@InderParmar 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="{your company}"]

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

@InderParmar 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="{your company}"]

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

@microsoft-github-policy-service agree

torchgeo/models/resnet.py Outdated Show resolved Hide resolved
@adamjstewart adamjstewart added this to the 0.6.2 milestone Oct 29, 2024
@InderParmar
Copy link
Contributor Author

Hi @adamjstewart , sorry for the confusion on my part, now I have made the appropriate changes, can you review the PR, and if there are no more concerns, can you add the "hacktoberfest-accepted" label to the PR, and then merge it before 1 November, I will be very thankful.

torchgeo/models/resnet.py Outdated Show resolved Hide resolved
torchgeo/models/resnet.py Outdated Show resolved Hide resolved
torchgeo/models/resnet.py Outdated Show resolved Hide resolved
torchgeo/models/resnet.py Outdated Show resolved Hide resolved
@InderParmar
Copy link
Contributor Author

Hi @adamjstewart , I have made all the requested changes, can you please review the PR, and let me know if there are any further changes required. Looking forward to it,If you find the PR is good, please add the "hacktoberfest-accepted" label to it before merging.

@adamjstewart
Copy link
Collaborator

I ended up removing the fMoW band designations. The RGB version of the dataset was created using a combination of:

# bands satellites RGB channels
4 QuickBird-2, GeoEye-1 3, 2, 1
8 WorldView-2, WorldView-3 5, 3, 2

Since the band numbers are not consistent, there's no way to provide a single set of band indices.

@adamjstewart adamjstewart changed the title Fixes #2364: Add Consistent bands Metadata to Vision Transformer and ResNet Weights Add Consistent bands Metadata to Vision Transformer and ResNet Weights Nov 1, 2024
@adamjstewart adamjstewart merged commit a473222 into microsoft:main Nov 1, 2024
19 checks passed
@adamjstewart
Copy link
Collaborator

Thanks for the PR! It's still technically October somewhere on Earth, so good luck with Hacktoberfest!

calebrob6 pushed a commit that referenced this pull request Dec 8, 2024
…hts (#2376)

* Added bands metadata to vit.py and resnet.py

* Added bands metadata to vit.py and resnet.py

* Fix duplicate bands keys and sort imports

* Fix duplicate bands keys and sort imports

* Fix duplicate bands keys and sort imports

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Save local changes

* Addressed requested changes in PR

* Addressed requested changes in PR

* Addressed requested changes in PR

* Reorder fmow, add scale-mae

* Remove fMoW bands

* Remove duplicate comments

---------

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
hacktoberfest-accepted models Models and pretrained weights
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing Band information for pretrained weights
2 participants