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 plot method and band selection to Zueri crop dataset #334

Merged
merged 9 commits into from
Dec 31, 2021

Conversation

nilsleh
Copy link
Collaborator

@nilsleh nilsleh commented Dec 29, 2021

This PR adds the plot method as well as the ability to select bands when instantiating the dataset. The dataset is a timeseries dataset with 9 channels from Sentinel satellite imagery.

Changes:

  • add band selection
  • normalization
  • plot method
  • changed fake dataset to have 9 channels to test band selection

Issues/Questions:

  • I was not able to find the specific band names the authors used so I contacted one of them and he stated that the band order is "NIR", "B03", "B02", "B04", "B05", "B06", "B07", "B11", "B12" and that the bands need to be normalized by 1e12, however, this yields tiny values and I read here that 1e4 is used to do the normalization
  • the dataset contains mask, boxes, and labels. Which of these should be plotted?

Example with draw_segmentation_mask:
zueriCrop

Alternative:
zueriCropAlternative

@github-actions github-actions bot added datasets Geospatial or benchmark datasets testing Continuous integration testing labels Dec 29, 2021
@isaaccorley
Copy link
Collaborator

  • That's a strange band ordering. I would expect it to just be the original Sentinel-2 band ordering.
  • You can divide Sentinel-2 by 1E4, however you may still find that it results in overly dark imagery. If so, just use our percentile normalization function.
  • ZeuriCrop is a instance segmentation dataset so you can just plot image and masks. The masks should already be of shape (num_instances, h, w) so you should be able to use torchvision's draw_segmentation_masks directly.
  • I extracted boxes from the instance masks only because torchvision's MaskRCNN expects boxes along with masks. However, you don't need to plot the boxes.

tests/datasets/test_zuericrop.py Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
tests/datasets/test_zuericrop.py Outdated Show resolved Hide resolved
tests/datasets/test_zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
torchgeo/datasets/zuericrop.py Outdated Show resolved Hide resolved
@adamjstewart adamjstewart added this to the 0.2.0 milestone Dec 31, 2021
@adamjstewart adamjstewart merged commit c90419b into microsoft:main Dec 31, 2021
@adamjstewart adamjstewart added utilities Utilities for working with geospatial data and removed utilities Utilities for working with geospatial data labels Jan 2, 2022
@nilsleh nilsleh deleted the zueriCrop branch February 16, 2022 13:20
@adamjstewart adamjstewart mentioned this pull request Mar 16, 2022
19 tasks
yichiac pushed a commit to yichiac/torchgeo that referenced this pull request Apr 29, 2023
* work on adding plotting method

* add band selection and plot method

* plot prediction

* plot mask instead of boxes

* sequence and alternative plot method

* sequence assert

* requested changes

* add comma

* sequence changes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
datasets Geospatial or benchmark datasets testing Continuous integration testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants