-
Notifications
You must be signed in to change notification settings - Fork 353
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
Sample in pixel units, not CRS units #279
Comments
I'm fine with adding this as a feature -- this is especially annoying with datasets in units of degrees (we do this here https://github.com/microsoft/torchgeo/blob/main/benchmark.py#L143) |
Perhaps you can help me understand what the intended behavior is, based on that benchmark. When passing a Currently, I am getting the latter behavior (which seems to be the intended one. from datasets import WatchRaster
import matplotlib.pyplot as plt
from torch.utils.data import DataLoader
from torchgeo.samplers import RandomGeoSampler
from torchgeo.datasets import stack_samples
import torch
ds = WatchRaster()
print(f'Dataset resolution: {ds.res}')
sampler = RandomGeoSampler(ds, size=512, length=5)
dl = DataLoader(ds, sampler=sampler, collate_fn=stack_samples)
for sample in dl:
image = sample['image']
print(image.shape)
The proposed change could be to modify |
Yes, latter behavior is correct, and proposed change is correct! We may want to think about how we name the args in the samplers, options:
|
I like former better. Make it a required arg so that the user is forced to choose. What's the voting process for these changes? @adamjstewart |
The former can be implemented as an enum to make it explicit in the code. |
I feel like there was a reason I originally chose to do things in CRS units, but I can't remember what that reason was. I'm fine with whatever. We could just only support sampling in pixel units. |
Related to #278, once our datasets are projected to UTM with fixed
xres
andyres
, I want to sample a set amount of pixels, say1024 x 1024
. Current samplers sample in the unit of the CRS (in this case meters). Therefore, I have to set the sample size todesired_chip_size / xres_yres_of_imagery
. While this works, a flag which lets the user choose which unit to sample in would be great.The text was updated successfully, but these errors were encountered: