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

Multiple roi in Sampler #536

Closed
Modexus opened this issue May 18, 2022 · 3 comments
Closed

Multiple roi in Sampler #536

Modexus opened this issue May 18, 2022 · 3 comments
Labels
samplers Samplers for indexing datasets
Milestone

Comments

@Modexus
Copy link

Modexus commented May 18, 2022

I have an issue with multiple roi's passed to a Sampler.

I am trying to use the same train/val/test set as Tile2Vec.
In the paper they split a singular roi in a 12x12 grid. Every grid cell is then assigned randomly to one of the three datasets.

The issue lies in that the sampler only take a single roi as an argument (the datasets as well). I can create the 12x12 grid but I am unable to assign multiple non-contigous regions to the train/val/test set.

Is it possible to somehow pass multiple regions as the roi argument (I am not familiar with rtree)?
My current workaround is changing GeoSampler to handle mutiple regions.

@adamjstewart
Copy link
Collaborator

I think you're right that it isn't possible with the current setup. I'm open to suggestions, either allowing multiple roi in a GeoSampler, or some kind of dataset_split method that supports grids.

@adamjstewart adamjstewart added the samplers Samplers for indexing datasets label May 18, 2022
@Modexus
Copy link
Author

Modexus commented May 18, 2022

Splitting the dataset directly does not seem feasible at the moment as the dataset does not allow for multiple rois (this would also be a good feature, for example using multiple regions of NAIP distributed over the country).

As mentioned my current workaround involves changing the GeoSampler to support multiple rois as well as using a roi_split_grid function that is passed to the sampler. This seems nice as the dataset does not have to be changed, just the samplers roi restricted (more generically as a roi_split function can be passed).

This does not work yet as it interferes with #537 but once I remove these it should.

@adamjstewart
Copy link
Collaborator

This feature was added by #866, see torchgeo.datasets.random_grid_cell_assignment.

@adamjstewart adamjstewart added this to the 0.5.0 milestone Sep 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
samplers Samplers for indexing datasets
Projects
None yet
Development

No branches or pull requests

2 participants