Skip to content

visibility into sub-regions within a UnionDataset #1613

Answered by adamjstewart
roybenhayun asked this question in Q&A
Discussion options

You must be logged in to vote

It's actually even simpler than that. If you have a directory image containing one or more Sentinel-2 images and mask containing 3 or more land cover subsets, you can use:

def setup(self, stage):
    eo_ds = Sentinel2("image")
    mask_ds = RasterDataset("mask")
    self.ds = eo_ds & mask_ds

You'll also want to declare one or more samplers here. TorchGeo will automatically only consider the regions highlighted in red where you have both image and mask data, it will never sample from the rest of the region.

To inspect further, you can access the dataset index attribute. All GeoDatasets in TorchGeo are modeled as R-trees. eo_ds.index is an R-tree containing the spatiotemporal bounding box o…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by roybenhayun
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
datasets Geospatial or benchmark datasets
2 participants