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 xView2 Dataset #236

Merged
merged 13 commits into from
Nov 15, 2021
Merged

Add xView2 Dataset #236

merged 13 commits into from
Nov 15, 2021

Conversation

isaaccorley
Copy link
Collaborator

@isaaccorley isaaccorley commented Nov 10, 2021

This PR adds the xView2 train/test set used in the xView2 challenge and described in "xBD: A Dataset for Assessing Building Damage from Satellite Imagery", Gupta et al. (2019)

This allows for a user to load the train/test 1024x1024 imagery and masks as a Vision Dataset, however in the homepage there are additional download links for non chipped imagery and the geojson labels which we should consider adding later as a Geo Dataset. This dataset cannot be automatically downloaded as you must register at the xView2 homepage and the download links expire after a few minutes.

  • Added a draw_semantic_segmentation_mask method to torchgeo.datasets.utils which takes an image tensor, semantic mask tensor (h, w), alpha blend factor, and colormap and overlays the mask onto the image, returning a numpy array which can be used for plotting

TODO:
- plot examples

  • add unit tests

Examples:

image
image

@isaaccorley isaaccorley marked this pull request as draft November 10, 2021 22:35
@isaaccorley isaaccorley self-assigned this Nov 10, 2021
@isaaccorley isaaccorley added the datasets Geospatial or benchmark datasets label Nov 10, 2021
torchgeo/datasets/xview.py Outdated Show resolved Hide resolved
torchgeo/datasets/xview.py Outdated Show resolved Hide resolved
)


ColorMap = Union[List[Union[str, Tuple[int, int, int]]], str, Tuple[int, int, int]]
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@isaaccorley
Copy link
Collaborator Author

@adamjstewart sphinx docs builds are failing due to the below errors. Any idea?

/home/runner/work/torchgeo/torchgeo/torchgeo/datasets/__init__.py:docstring of torchgeo.datasets.xview.XView2.plot:: WARNING: py:class reference target not found: matplotlib.figure.Figure
/home/runner/work/torchgeo/torchgeo/torchgeo/datasets/__init__.py:docstring of torchgeo.datasets.VisionClassificationDataset:1: WARNING: py:class reference target not found: torchvision.datasets.folder.ImageFolder

@calebrob6
Copy link
Member

@isaaccorley this is from the intersphinx mapping, fix is here

"matplotlib": ("https://matplotlib.org/stable/", None),
(should be merged soon)

@calebrob6 calebrob6 marked this pull request as ready for review November 14, 2021 22:36
@calebrob6
Copy link
Member

calebrob6 commented Nov 14, 2021

@adamjstewart @isaaccorley I think this is finished now.

Some notes:

  • It seems like in many datasets we aren't handing the "checksum" argument properly (i.e. it is only checked in the code path that downloads the dataset).
  • This dataset has pre- and post-disaster imagery with pre- and post-disaster building masks/damage labels, so it will not fit nicely with the pre-canned SemanticSegmentationTask.
  • We should make it clear that this is the "Challenge training set" and "Challenge test set" data from the xView2 website. I'll do this with any last changes that need to happen.



class TestXView2:
@pytest.fixture(params=["train", "test"])
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
@pytest.fixture(params=["train", "test"])
@pytest.fixture(scope="class", params=["train", "test"])

Copy link
Member

Choose a reason for hiding this comment

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

This breaks the tests

Copy link
Member

Choose a reason for hiding this comment

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

ScopeMismatch: You tried to access the 'function' scoped fixture 'monkeypatch' with a 'class' scoped request object, involved factories

torchgeo/datasets/utils.py Outdated Show resolved Hide resolved
torchgeo/datasets/xview.py Outdated Show resolved Hide resolved
calebrob6 and others added 3 commits November 14, 2021 21:00
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
@adamjstewart adamjstewart merged commit 922ec05 into microsoft:main Nov 15, 2021
@isaaccorley isaaccorley deleted the datasets/xview2 branch November 15, 2021 16:16
@adamjstewart adamjstewart added this to the 0.2.0 milestone Nov 20, 2021
@adamjstewart adamjstewart added datamodules PyTorch Lightning datamodules utilities Utilities for working with geospatial data and removed utilities Utilities for working with geospatial data labels Jan 2, 2022
yichiac pushed a commit to yichiac/torchgeo that referenced this pull request Apr 29, 2023
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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants