Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conda's environment.yml: install pytorch gpu by pegging cudatoolkit to <= v11.5 #540

Closed
wants to merge 43 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
673787f
environment.yml: peg cudatoolkit to max v11.5
remtav May 25, 2022
8a05ab1
Remove type ignores for PyTorch (#460)
adamjstewart Mar 14, 2022
728a7a1
Update hook (#464)
ashnair1 Mar 15, 2022
88848ad
SpaceNet2 update (#469)
ashnair1 Mar 18, 2022
ad85c85
VectorDataset: fix issue with empty query (#467)
adamjstewart Mar 19, 2022
8c41555
Fix integration tests on macOS/Windows (#468)
adamjstewart Mar 19, 2022
ccddefb
gitattributes: allow diff of test data (#470)
adamjstewart Mar 19, 2022
3389489
dos2unix: zuericrop data.py
adamjstewart Mar 19, 2022
944aed7
Update train.py integration tests (#472)
adamjstewart Mar 20, 2022
17d9b4a
Chesapeake: skip all tests if zipfile_deflate64 missing (#471)
adamjstewart Mar 20, 2022
fa2767a
Revert "Fix PyTorch + setuptools bug (#357)" (#473)
adamjstewart Mar 20, 2022
ff52c84
setup.cfg: no longer need hack for pre-release black (#474)
adamjstewart Mar 20, 2022
2064311
CI: h5py now provides Windows wheels (#475)
adamjstewart Mar 20, 2022
c8dac17
Add own plot method and data.py to CBF (#410)
nilsleh Mar 20, 2022
9039aa8
Add SpaceNet3 (#480)
ashnair1 Mar 29, 2022
27393da
Drop Python 3.6 support (#482)
adamjstewart Mar 29, 2022
4ea3415
Fix PyTorch Lightning 1.6 type hints (#487)
adamjstewart Mar 30, 2022
3d4f42c
Update hooks (#489)
ashnair1 Mar 30, 2022
f72f4fe
Upgrade all files to Python 3.7+ syntax (#486)
adamjstewart Mar 30, 2022
42f044d
RasterDataset: remove plot method (#476)
adamjstewart Mar 30, 2022
1d212c3
Correct tag for pyupgrade hook (#490)
ashnair1 Mar 30, 2022
55cd318
remove random (#491)
nilsleh Mar 31, 2022
67c7f37
Add Swedish Forest Damage dataset (#461)
nilsleh Apr 2, 2022
752644f
default fcsiam models to random init for tests (#497)
isaaccorley Apr 4, 2022
fa38b2d
Indices tutorial: better normalization for true color plot (#493)
adamjstewart Apr 5, 2022
4f459a8
Add PreChippedGeoSampler for pre-chipped geospatial datasets (#479)
adamjstewart Apr 5, 2022
198f65c
git pre-commit: run pyupgrade first (#494)
adamjstewart Apr 5, 2022
e83f0f5
RandomGeoSampler: several bug fixes (#477)
adamjstewart Apr 5, 2022
50f676f
Fix case of missing label in Forest Damage dataset (#499)
nilsleh Apr 8, 2022
61247db
Add plot method and data.py to NAIP (#407)
nilsleh Apr 9, 2022
a67f1de
Cast uint16 tensors to int32, leave float32 tensors as they are (#502)
khdlr Apr 11, 2022
bf19ac8
Don't subtract microsecond from mint (#506)
adamjstewart Apr 19, 2022
0770307
Type hints: PEP 561 compliance (#508)
adamjstewart Apr 20, 2022
ab66ed9
Landsat: add support for all Level-1 and Level-2 products (#504)
adamjstewart Apr 20, 2022
ea3729c
Fix error when using other than 4 channel images with BYOL task (#522)
gaetanbahl May 2, 2022
a93d54b
add channels to prevent conda's ResolvePackageError on Windows (#528)
remtav May 6, 2022
aa23a60
Add GBIF dataset (#507)
adamjstewart May 6, 2022
94505f6
Test on Python 3.10 (#457)
adamjstewart May 6, 2022
1dd37d1
Tutorials: fix NAIP downloads (#531)
adamjstewart May 6, 2022
960081b
Add iNaturalist dataset (#532)
adamjstewart May 15, 2022
9151a95
Add EDDMapS dataset (#533)
adamjstewart May 15, 2022
4855c8f
Use stable docs (#539)
ashnair1 May 19, 2022
eeac9f7
Add Inria datamodule (#498)
ashnair1 May 22, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# Do not change line endings on test data, it will change the MD5
/tests/data/*/** binary
/tests/data/*/** -text
# Test data generation files are fine though
/tests/data/**/data.py text
16 changes: 11 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: |
pip install cython numpy # needed for pycocotools
pip install --pre 'rasterio>=1.0.16'
pip install .[tests]
pip list
- name: Run pytest checks
run: pytest --cov=torchgeo --cov-report=xml
integration:
Expand All @@ -32,9 +33,12 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: pip install .[datasets,tests]
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[datasets,tests]
pip list
- name: Run integration checks
run: pytest -m slow
notebooks:
Expand All @@ -46,11 +50,13 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[datasets,tests]
pip install -r docs/requirements.txt
pip list
- name: Run notebook checks
env:
MLHUB_API_KEY: ${{ secrets.MLHUB_API_KEY }}
Expand Down
45 changes: 37 additions & 8 deletions .github/workflows/style.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: pip install .[style]
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[style]
pip list
- name: Run black checks
run: black . --check --diff
flake8:
Expand All @@ -32,9 +35,12 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: pip install .[style]
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[style]
pip list
- name: Run flake8 checks
run: flake8
isort:
Expand All @@ -46,9 +52,12 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: pip install .[style]
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[style]
pip list
- name: Run isort checks
run: isort . --check --diff
pydocstyle:
Expand All @@ -60,8 +69,28 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: pip install .[style]
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[style]
pip list
- name: Run pydocstyle checks
run: pydocstyle
pyupgrade:
name: pyupgrade
runs-on: ubuntu-latest
steps:
- name: Clone repo
uses: actions/checkout@v2
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pip dependencies
run: |
pip install --pre 'rasterio>=1.0.16'
pip install .[style]
pip list
- name: Run pyupgrade checks
run: pyupgrade --py37-plus $(find . -name "*.py")
17 changes: 7 additions & 10 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ jobs:
- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: '3.10'
- name: Install pip dependencies
run: |
pip install cython numpy # needed for pycocotools
pip install --pre 'rasterio>=1.0.16'
pip install .[datasets,tests]
pip list
- name: Run mypy checks
run: mypy .
pytest:
Expand All @@ -33,10 +34,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.6, 3.7, 3.8, 3.9]
exclude:
- os: windows-latest
python-version: 3.6
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- name: Clone repo
uses: actions/checkout@v2
Expand All @@ -59,16 +57,15 @@ jobs:
if: ${{ runner.os == 'Windows' }}
- name: Install conda dependencies (Windows)
run: |
# PyTorch isn't compatible with setuptools 59.6+, pin for now until new PyTorch release
# https://github.com/pytorch/pytorch/pull/69904
conda install 'fiona>=1.5' h5py 'rasterio>=1.0.16' 'setuptools<59.6'
conda install 'fiona>=1.5' 'rasterio>=1.0.16'
conda list
conda info
if: ${{ runner.os == 'Windows' }}
- name: Install pip dependencies
run: |
pip install cython numpy # needed for pycocotools
pip install --pre 'rasterio>=1.0.16'
pip install .[datasets,tests]
pip list
- name: Run pytest checks
run: pytest --cov=torchgeo --cov-report=xml
- name: Report coverage
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
/data/
/logs/
/output/
*.csv
*.pdf

# Spack
Expand Down
12 changes: 9 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
repos:
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.1
hooks:
- id: pyupgrade
args: [--py37-plus]

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
additional_dependencies: ["colorama>=0.4.3"]

- repo: https://github.com/psf/black
rev: 22.1.0
rev: 22.3.0
hooks:
- id: black
args: [--skip-magic-trailing-comma]
Expand All @@ -24,9 +30,9 @@ repos:
additional_dependencies: ["toml"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.931
rev: v0.942
hooks:
- id: mypy
args: [--strict, --ignore-missing-imports, --show-error-codes]
additional_dependencies: [torch>=1.7, torchmetrics>=0.7, pytorch-lightning>=1.3, pytest>=6, omegaconf>=2.1, kornia>=0.6, numpy>=1.22.0]
additional_dependencies: [torch>=1.11, torchmetrics>=0.7, pytorch-lightning>=1.6, pytest>=6, omegaconf>=2.1, kornia>=0.6, numpy>=1.22.0]
exclude: (build|data|dist|logo|logs|output)/
6 changes: 6 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
# Required
version: 2

# Set the version of Python
build:
os: ubuntu-20.04
tools:
python: "3.9"

# Configuration of the Python environment to be used
python:
install:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ In this example, we show how easy it is to work with geospatial data and to samp

```python
landsat7 = Landsat7(root="...")
landsat8 = Landsat8(root="...", bands=["B2", "B3", "B4", "B5", "B6", "B7", "B8", "B9"])
landsat8 = Landsat8(root="...", bands=Landsat8.all_bands[1:-2])
landsat = landsat7 | landsat8
```

Expand Down
10 changes: 4 additions & 6 deletions benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,15 @@ def main(args: argparse.Namespace) -> None:
# Benchmark model
model = resnet34()
# Change number of input channels to match Landsat
model.conv1 = nn.Conv2d( # type: ignore[attr-defined]
model.conv1 = nn.Conv2d(
len(bands), 64, kernel_size=7, stride=2, padding=3, bias=False
)

criterion = nn.CrossEntropyLoss() # type: ignore[attr-defined]
criterion = nn.CrossEntropyLoss()
params = model.parameters()
optimizer = optim.SGD(params, lr=0.0001)

device = torch.device( # type: ignore[attr-defined]
"cuda" if torch.cuda.is_available() else "cpu", args.device
)
device = torch.device("cuda" if torch.cuda.is_available() else "cpu", args.device)
model = model.to(device)

tic = time.time()
Expand All @@ -227,7 +225,7 @@ def main(args: argparse.Namespace) -> None:
num_total_patches += args.batch_size
x = torch.rand(args.batch_size, len(bands), args.patch_size, args.patch_size)
# y = torch.randint(0, 256, (args.batch_size, args.patch_size, args.patch_size))
y = torch.randint(0, 256, (args.batch_size,)) # type: ignore[attr-defined]
y = torch.randint(0, 256, (args.batch_size,))
x = x.to(device)
y = y.to(device)

Expand Down
30 changes: 30 additions & 0 deletions conf/inria.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
program:
overwrite: True


trainer:
gpus: 1
min_epochs: 5
max_epochs: 100
benchmark: True
log_every_n_steps: 2

experiment:
task: "inria"
name: "inria_test"
module:
loss: "ce"
segmentation_model: "unet"
encoder_name: "resnet18"
encoder_weights: "imagenet"
learning_rate: 1e-3
learning_rate_schedule_patience: 6
in_channels: 3
num_classes: 2
ignore_zeros: True # class 0 not used for scoring
datamodule:
root_dir: "data/inria"
batch_size: 2
num_workers: 32
patch_size: 512
num_patches_per_tile: 4
5 changes: 5 additions & 0 deletions docs/api/datamodules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ FAIR1M (Fine-grAined object recognItion in high-Resolution imagery)

.. autoclass:: FAIR1MDataModule

Inria Aerial Image Labeling
^^^^^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: InriaAerialImageLabelingDataModule

LandCover.ai (Land Cover from Aerial Imagery)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
23 changes: 22 additions & 1 deletion docs/api/datasets.rst
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ Cropland Data Layer (CDL)

.. autoclass:: CDL

EDDMapS
^^^^^^^

.. autoclass:: EDDMapS

EnviroAtlas
^^^^^^^^^^^

Expand All @@ -67,11 +72,21 @@ EU-DEM

.. autoclass:: EUDEM

GBIF
^^^^

.. autoclass:: GBIF

GlobBiomass
^^^^^^^^^^^

.. autoclass:: GlobBiomass

iNaturalist
^^^^^^^^^^^

.. autoclass:: INaturalist

Landsat
^^^^^^^

Expand All @@ -96,7 +111,7 @@ Open Buildings
^^^^^^^^^^^^^^

.. autoclass:: OpenBuildings

Sentinel
^^^^^^^^

Expand Down Expand Up @@ -157,6 +172,11 @@ FAIR1M (Fine-grAined object recognItion in high-Resolution imagery)

.. autoclass:: FAIR1M

Forest Damage
^^^^^^^^^^^^^

.. autoclass:: ForestDamage

GID-15 (Gaofen Image Dataset)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down Expand Up @@ -233,6 +253,7 @@ SpaceNet
.. autoclass:: SpaceNet
.. autoclass:: SpaceNet1
.. autoclass:: SpaceNet2
.. autoclass:: SpaceNet3
.. autoclass:: SpaceNet4
.. autoclass:: SpaceNet5
.. autoclass:: SpaceNet7
Expand Down
5 changes: 5 additions & 0 deletions docs/api/samplers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ Grid Geo Sampler

.. autoclass:: GridGeoSampler

Pre-chipped Geo Sampler
^^^^^^^^^^^^^^^^^^^^^^^

.. autoclass:: PreChippedGeoSampler

Batch Samplers
--------------

Expand Down
Loading