GeoSampler#

class torchgeo.samplers.GeoSampler[source]#

Bases: Sampler[slice | tuple[slice] | tuple[slice, slice] | tuple[slice, slice, slice]], ABC

Abstract base class for sampling from GeoDataset.

Unlike PyTorch’s Sampler, GeoSampler returns a GeoSlice that can uniquely index any GeoDataset.

abstractmethod __iter__()[source]#

Iterate over generated sample locations for each epoch.

Yields:

[xmin – xmax, ymin:ymax, tmin:tmax] coordinates to index a dataset.

__len__()[source]#

Length of each epoch.

Returns:

The sampler length.

Return type:

int

__annotate_func__()[source]#

The type of the None singleton.