-
Notifications
You must be signed in to change notification settings - Fork 443
Feature/rasterized vectordataset support #2505 #2785
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
base: main
Are you sure you want to change the base?
Feature/rasterized vectordataset support #2505 #2785
Conversation
…ask && geoemtries clipped if outside of query window
…sterization for binary and multilabel masks
@sherif-med please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Why do we need |
As mentioned in #2505 some tasks require geometries instead of masks as input. Also the name VectorDataset is counter-intuitive as its elements are images/masks. |
The names are based on supported file types, not returned keys. The idea of #2505 is to modify |
Great, do you think a switcher method within VectorDataset to alter the output of getitem dynamically is a good solution? |
Summary
This PR introduces the
RasterizedVectorDataset
, a subclass ofVectorDataset
, to enable loading vector data as rasterized masks, addressing issue #2505 . It includes:RasterizedVectorDataset
RasterizationStrategy
andDefaultRasterizationStrategy
Motivation
Many geospatial tasks (e.g., semantic segmentation) require vector labels to be rasterized. This new dataset class simplifies workflows by seamlessly integrating rasterized vector data into TorchGeo’s dataset ecosystem.
Docs Updated
docs/tutorials/custom_raster_dataset.ipynb
: Added explanations forRasterizedVectorDataset
docs/user/alternatives.rst
: AddedRasterizedVectorDataset
to comparison overviewTests
tests/datasets/test_geo.py
for:__getitem__
Affected Files (Highlights)
torchgeo/datasets/geo.py
: Implementation ofRasterizedVectorDataset
,RasterizationStrategy
torchgeo/datasets/cbf.py
,eurocrops.py
: Switched to useRasterizedVectorDataset
torchgeo/datasets/__init__.py
: Added new classes to exportsExample Usage
Future Enhancements