visibility into sub-regions within a UnionDataset #1613
-
Hi, so we try to use the cool feature of interesction and union of datasets. we create 3 masks, per each AOI and use intersections and unions in this way:
the output is:
first, just to be sure, is this a right way to use intersections and unions with TorchGeo? the other question is how to get visibility into the sub regions in the resulting UnionDataset? seeing a BoundingBox in the console output is somwhat confusing since intuitively would assume there are 3 bounding boxes per each intersection. would have been good to be able to get some way of inspecting \ debugging the UnionDataset mostly for visibility and validation. perhaps the 3 bounding boxes, or other. so how are the sub regions represented, can we be sure there are indeed small sub regions and not a big bounding box as we hoped to avoid, and how can we inspect validate the union of sub regions? thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It's actually even simpler than that. If you have a directory 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 For more details, see:
|
Beta Was this translation helpful? Give feedback.
It's actually even simpler than that. If you have a directory
image
containing one or more Sentinel-2 images andmask
containing 3 or more land cover subsets, you can use: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…