58d05d5950 | ||
---|---|---|
.github/workflows | ||
conf | ||
docs | ||
logo | ||
tests | ||
torchgeo | ||
.codecov.yml | ||
.flake8 | ||
.gitattributes | ||
.gitignore | ||
.pre-commit-config.yaml | ||
CODE_OF_CONDUCT.md | ||
LICENSE | ||
README.md | ||
SECURITY.md | ||
SUPPORT.md | ||
environment.yml | ||
pyproject.toml | ||
requirements.txt | ||
setup.cfg | ||
setup.py | ||
spack.yaml | ||
test_chesapeakecvpr_models.py | ||
train.py |
README.md
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
Until the first release, you can install an environment compatible with torchgeo with conda
, pip
, or spack
as shown below.
Conda
Note: if you do not have access to a GPU or are running on macOS, replace pytorch-gpu
with pytorch-cpu
in the environment.yml
file.
$ conda config --set channel_priority strict
$ conda env create --file environment.yml
$ conda activate torchgeo
Pip
With Python 3.6 or later:
$ pip install -r requirements.txt
Spack
$ spack env activate .
$ spack install
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]["wind_speed"])
Contributing
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 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.
Trademarks
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.