6f23fa42c5
* OSCDDataModule: add random crop augmentation * typing: use sequence instead of tuple * use RandomCrop * Use kornia instead * add description of crop_size * Only RandomCrop train and val set, not test set * black fix * working random_crops * Resizing dummy test data to 3x3 so we can test RandomCrop Augmentations * assert crops are proper size * not working yet but some progress * issue with amount of slices * forgot to set val and test batch_size to 1 * some style fixes * setting the dataset.transforms attribute doesn't work unless you do it in __init__ for now val_dataset must have random crop * nevermind we don't need this * style fixes + do we need mask to be torch.long? * einops * unsure why this doesn't work * dataset.transforms * mypy fix * hacky flake8 fix * non-hacky flake8 fix * mypy fix * adjust val test size * passing tests * mypy fix * adding n_random_crops * adjust param in testing * working collate_fn but breaks mypy * flattening (2, 13) into 26 * fix mypy * style fixes * add testing for new shapes * Adjusting DataModule docstring * remove clamp since we are standardizing * name change to train_batch_size * splitting crop-size into patch_size and num_patches_per_tile |
||
---|---|---|
.github/workflows | ||
conf | ||
docs | ||
experiments | ||
logo | ||
tests | ||
torchgeo | ||
.codecov.yml | ||
.flake8 | ||
.gitattributes | ||
.gitignore | ||
.pre-commit-config.yaml | ||
.readthedocs.yaml | ||
CITATION.cff | ||
CODE_OF_CONDUCT.md | ||
LICENSE | ||
README.md | ||
SECURITY.md | ||
SUPPORT.md | ||
benchmark.py | ||
environment.yml | ||
evaluate.py | ||
pyproject.toml | ||
setup.cfg | ||
setup.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
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"])
Citation
If you use this software in your work, please cite our paper:
@article{Stewart_TorchGeo_deep_learning_2021,
author = {Stewart, Adam J. and Robinson, Caleb and Corley, Isaac A. and Ortiz, Anthony and Lavista Ferres, Juan M. and Banerjee, Arindam},
journal = {arXiv preprint arXiv:2111.08872},
month = {11},
title = {{TorchGeo: deep learning with geospatial data}},
url = {https://github.com/microsoft/torchgeo},
year = {2021}
}
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.