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.
Until the first release, you can install an environment compatible with torchgeo with
spack as shown below.
Note: if you do not have access to a GPU or are running on macOS, replace
pytorch-cpu in the
$ conda config --set channel_priority strict $ conda env create --file environment.yml $ conda activate torchgeo
With Python 3.6 or later:
$ pip install -r requirements.txt
$ spack env activate . $ spack install
You can find the documentation for torchgeo on ReadTheDocs.
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
LightningDataModules 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
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["image"].shape) print(dataset["wind_speed"])
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.