How RasterDataset() for image folder and mask folder matches corresponding image and mask pair #1014
-
I tried to understand how RasterDataset class indexes files in a folder to be sure if when called on image folder and mask folder will index (match) them correctly in dataLoader. For example; ds = RasterDataset(image_f) & RasterDataset(mask_f) How is the indexing done? Is it order of filename such that both image and mask should have same filenames or by spatial bounds? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
You might want to read https://arxiv.org/abs/2111.08872 TL;DR: all GeoDatasets (including RasterDataset and VectorDataset) read the geographic metadata from each file and build a spatiotemporal R-tree. The sampler gets this R-tree from the dataset and decides where to sample from. The sampler chooses a spatiotemporal bounding box, and each dataset checks its own R-tree to see which files overlap with that bounding box. Then we use rasterio windowed reading to automatically merge all files at that location into a single image and/or mask. |
Beta Was this translation helpful? Give feedback.
You might want to read https://arxiv.org/abs/2111.08872
TL;DR: all GeoDatasets (including RasterDataset and VectorDataset) read the geographic metadata from each file and build a spatiotemporal R-tree. The sampler gets this R-tree from the dataset and decides where to sample from. The sampler chooses a spatiotemporal bounding box, and each dataset checks its own R-tree to see which files overlap with that bounding box. Then we use rasterio windowed reading to automatically merge all files at that location into a single image and/or mask.