3.7 KiB
TorchGeo is a PyTorch domain library, similar to torchvision, that provides datasets, transforms, samplers, and pre-trained models specific to geospatial data.
The goal of this library is to make it simple:
- for machine learning experts to use geospatial data in their workflows, and
- for remote sensing experts to use their data in machine learning workflows.
See our installation instructions, documentation, and examples to learn how to use torchgeo.
Installation instructions
The recommended way to install TorchGeo is with pip:
$ pip install torchgeo
For conda and spack installation instructions, see the documentation.
Documentation
You can find the documentation for torchgeo on ReadTheDocs.
Example usage
The following sections give basic examples of what you can do with torchgeo. For more examples, check out our tutorials.
Train and test models using our PyTorch Lightning based training script
We provide a script, train.py
for training models using a subset of the datasets. We do this with the PyTorch Lightning LightningModule
s and LightningDataModule
s implemented under the torchgeo.trainers
namespace.
The train.py
script is configurable via the command line and/or via YAML configuration files. See the conf/ directory for example configuration files that can be customized for different training runs.
$ python train.py config_file=conf/landcoverai.yaml
Download and use the Tropical Cyclone Wind Estimation Competition dataset
This dataset is from a competition hosted by Driven Data in collaboration with Radiant Earth. See here for more information.
Using this dataset in torchgeo is as simple as importing and instantiating the appropriate class.
import torchgeo.datasets
dataset = torchgeo.datasets.TropicalCycloneWindEstimation(split="train", download=True)
print(dataset[0]["image"].shape)
print(dataset[0]["label"])
Contributing
This project welcomes contributions and suggestions. If you would like to submit a pull request, see our Contribution Guide for more information.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.