From 4f5606501124be3f92180827f65cb6c33f03de05 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 20:56:29 +0000 Subject: [PATCH 1/7] Bump shapely from 1.8.4 to 1.8.5 in /requirements (#839) Bumps [shapely](https://github.com/shapely/shapely) from 1.8.4 to 1.8.5. - [Release notes](https://github.com/shapely/shapely/releases) - [Changelog](https://github.com/shapely/shapely/blob/1.8.5/CHANGES.txt) - [Commits](https://github.com/shapely/shapely/compare/1.8.4...1.8.5) --- updated-dependencies: - dependency-name: shapely dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/required.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/required.txt b/requirements/required.txt index 3263cfe749f..2b73759a6a7 100644 --- a/requirements/required.txt +++ b/requirements/required.txt @@ -16,7 +16,7 @@ rasterio==1.3.2;python_version>='3.8' rtree==1.0.0 scikit-learn==1.1.2;python_version>='3.8' segmentation-models-pytorch==0.3.0 -shapely==1.8.4 +shapely==1.8.5 timm==0.4.12 torch==1.12.1 torchmetrics==0.10.0 From 072e8a9f703407117483efd79b8f905e76c5a25d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 12 Oct 2022 20:57:26 +0000 Subject: [PATCH 2/7] Bump numpy from 1.23.3 to 1.23.4 in /requirements (#838) Bumps [numpy](https://github.com/numpy/numpy) from 1.23.3 to 1.23.4. - [Release notes](https://github.com/numpy/numpy/releases) - [Changelog](https://github.com/numpy/numpy/blob/main/doc/RELEASE_WALKTHROUGH.rst) - [Commits](https://github.com/numpy/numpy/compare/v1.23.3...v1.23.4) --- updated-dependencies: - dependency-name: numpy dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/required.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/required.txt b/requirements/required.txt index 2b73759a6a7..9004a6ec194 100644 --- a/requirements/required.txt +++ b/requirements/required.txt @@ -6,7 +6,7 @@ einops==0.5.0 fiona==1.9a2 kornia==0.6.7 matplotlib==3.6.1 -numpy==1.23.3;python_version>='3.8' +numpy==1.23.4;python_version>='3.8' omegaconf==2.2.3 packaging==21.3 pillow==9.2.0 From 87dfb17328396c52a7a67be0ae94e5c3d66c2973 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Oct 2022 16:04:29 -0500 Subject: [PATCH 3/7] Bump kornia from 0.6.7 to 0.6.8 in /requirements (#844) Bumps [kornia](https://github.com/kornia/kornia) from 0.6.7 to 0.6.8. - [Release notes](https://github.com/kornia/kornia/releases) - [Changelog](https://github.com/kornia/kornia/blob/master/CHANGELOG.md) - [Commits](https://github.com/kornia/kornia/compare/v0.6.7...v0.6.8) --- updated-dependencies: - dependency-name: kornia dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/required.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/required.txt b/requirements/required.txt index 9004a6ec194..94a5e51a70f 100644 --- a/requirements/required.txt +++ b/requirements/required.txt @@ -4,7 +4,7 @@ setuptools==65.4.0 # install einops==0.5.0 fiona==1.9a2 -kornia==0.6.7 +kornia==0.6.8 matplotlib==3.6.1 numpy==1.23.4;python_version>='3.8' omegaconf==2.2.3 From b977f808133c5cb24cf85c75b808c6b141293fbb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Oct 2022 16:04:45 -0500 Subject: [PATCH 4/7] Bump shapely from 1.8.5 to 1.8.5.post1 in /requirements (#843) Bumps [shapely](https://github.com/shapely/shapely) from 1.8.5 to 1.8.5.post1. - [Release notes](https://github.com/shapely/shapely/releases) - [Changelog](https://github.com/shapely/shapely/blob/1.8.5.post1/CHANGES.txt) - [Commits](https://github.com/shapely/shapely/compare/1.8.5...1.8.5.post1) --- updated-dependencies: - dependency-name: shapely dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- requirements/required.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements/required.txt b/requirements/required.txt index 94a5e51a70f..831e335c309 100644 --- a/requirements/required.txt +++ b/requirements/required.txt @@ -16,7 +16,7 @@ rasterio==1.3.2;python_version>='3.8' rtree==1.0.0 scikit-learn==1.1.2;python_version>='3.8' segmentation-models-pytorch==0.3.0 -shapely==1.8.5 +shapely==1.8.5.post1 timm==0.4.12 torch==1.12.1 torchmetrics==0.10.0 From 3f47ea3a299dae604c4ad4b57f2cffd2b08c786f Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 13 Oct 2022 16:16:58 -0500 Subject: [PATCH 5/7] Update torchmetrics dep in other places (#832) --- .pre-commit-config.yaml | 2 +- environment.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b773130cd03..459d3a94557 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,5 +34,5 @@ repos: hooks: - id: mypy args: [--strict, --ignore-missing-imports, --show-error-codes] - additional_dependencies: [torch>=1.11, torchmetrics>=0.7, pytorch-lightning>=1.7, pytest>=6, omegaconf>=2.1, kornia>=0.6, numpy>=1.22.0] + additional_dependencies: [torch>=1.11, torchmetrics>=0.10, pytorch-lightning>=1.7, pytest>=6, omegaconf>=2.1, kornia>=0.6, numpy>=1.22.0] exclude: (build|data|dist|logo|logs|output)/ diff --git a/environment.yml b/environment.yml index ad77ef2f7fa..dafd0778a56 100644 --- a/environment.yml +++ b/environment.yml @@ -46,5 +46,5 @@ dependencies: - setuptools>=42 - sphinx>=4 - timm>=0.4.12 - - torchmetrics>=0.7 + - torchmetrics>=0.10 - zipfile-deflate64>=0.2 From 04b23c010a39212680424dc8841c0ff205bdd679 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 13 Oct 2022 21:26:20 +0000 Subject: [PATCH 6/7] Bump rtree from 1.0.0 to 1.0.1 in /requirements (#836) * Bump rtree from 1.0.0 to 1.0.1 in /requirements Bumps [rtree](https://github.com/Toblerity/rtree) from 1.0.0 to 1.0.1. - [Release notes](https://github.com/Toblerity/rtree/releases) - [Commits](https://github.com/Toblerity/rtree/compare/1.0.0...1.0.1) --- updated-dependencies: - dependency-name: rtree dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * Fix typing issues Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Adam J. Stewart --- requirements/required.txt | 2 +- torchgeo/datasets/chesapeake.py | 4 ++-- torchgeo/datasets/enviroatlas.py | 4 ++-- torchgeo/datasets/geo.py | 7 ++----- torchgeo/datasets/globbiomass.py | 4 ++-- torchgeo/datasets/openbuildings.py | 4 ++-- 6 files changed, 11 insertions(+), 14 deletions(-) diff --git a/requirements/required.txt b/requirements/required.txt index 831e335c309..9933383861e 100644 --- a/requirements/required.txt +++ b/requirements/required.txt @@ -13,7 +13,7 @@ pillow==9.2.0 pyproj==3.4.0;python_version>='3.8' pytorch-lightning==1.7.7 rasterio==1.3.2;python_version>='3.8' -rtree==1.0.0 +rtree==1.0.1 scikit-learn==1.1.2;python_version>='3.8' segmentation-models-pytorch==0.3.0 shapely==1.8.5.post1 diff --git a/torchgeo/datasets/chesapeake.py b/torchgeo/datasets/chesapeake.py index db529646836..454c52f980b 100644 --- a/torchgeo/datasets/chesapeake.py +++ b/torchgeo/datasets/chesapeake.py @@ -6,7 +6,7 @@ import abc import os import sys -from typing import Any, Callable, Dict, Optional, Sequence +from typing import Any, Callable, Dict, List, Optional, Sequence, cast import fiona import matplotlib.pyplot as plt @@ -634,7 +634,7 @@ def __getitem__(self, query: BoundingBox) -> Dict[str, Any]: IndexError: if query is not found in the index """ hits = self.index.intersection(tuple(query), objects=True) - filepaths = [hit.object for hit in hits] + filepaths = cast(List[Dict[str, str]], [hit.object for hit in hits]) sample = {"image": [], "mask": [], "crs": self.crs, "bbox": query} diff --git a/torchgeo/datasets/enviroatlas.py b/torchgeo/datasets/enviroatlas.py index 07737f6fc4c..7431bebab2d 100644 --- a/torchgeo/datasets/enviroatlas.py +++ b/torchgeo/datasets/enviroatlas.py @@ -5,7 +5,7 @@ import os import sys -from typing import Any, Callable, Dict, Optional, Sequence +from typing import Any, Callable, Dict, List, Optional, Sequence, cast import fiona import matplotlib.pyplot as plt @@ -343,7 +343,7 @@ def __getitem__(self, query: BoundingBox) -> Dict[str, Any]: IndexError: if query is not found in the index """ hits = self.index.intersection(tuple(query), objects=True) - filepaths = [hit.object for hit in hits] + filepaths = cast(List[Dict[str, str]], [hit.object for hit in hits]) sample = {"image": [], "mask": [], "crs": self.crs, "bbox": query} diff --git a/torchgeo/datasets/geo.py b/torchgeo/datasets/geo.py index ff75814c75f..f21c7901a97 100644 --- a/torchgeo/datasets/geo.py +++ b/torchgeo/datasets/geo.py @@ -180,10 +180,7 @@ def __str__(self) -> str: def __getstate__( self, - ) -> Tuple[ - Dict[Any, Any], - List[Tuple[int, Tuple[float, float, float, float, float, float], str]], - ]: + ) -> Tuple[Dict[str, Any], List[Tuple[Any, Any, Optional[Any]]]]: """Define how instances are pickled. Returns: @@ -407,7 +404,7 @@ def __getitem__(self, query: BoundingBox) -> Dict[str, Any]: IndexError: if query is not found in the index """ hits = self.index.intersection(tuple(query), objects=True) - filepaths = [hit.object for hit in hits] + filepaths = cast(List[str], [hit.object for hit in hits]) if not filepaths: raise IndexError( diff --git a/torchgeo/datasets/globbiomass.py b/torchgeo/datasets/globbiomass.py index 270a72a3734..4dd6b8aca07 100644 --- a/torchgeo/datasets/globbiomass.py +++ b/torchgeo/datasets/globbiomass.py @@ -5,7 +5,7 @@ import glob import os -from typing import Any, Callable, Dict, Optional +from typing import Any, Callable, Dict, List, Optional, cast import matplotlib.pyplot as plt import torch @@ -176,7 +176,7 @@ def __getitem__(self, query: BoundingBox) -> Dict[str, Any]: IndexError: if query is not found in the index """ hits = self.index.intersection(tuple(query), objects=True) - filepaths = [hit.object for hit in hits] + filepaths = cast(List[str], [hit.object for hit in hits]) if not filepaths: raise IndexError( diff --git a/torchgeo/datasets/openbuildings.py b/torchgeo/datasets/openbuildings.py index 8ccd760e577..f8e377a9c95 100644 --- a/torchgeo/datasets/openbuildings.py +++ b/torchgeo/datasets/openbuildings.py @@ -7,7 +7,7 @@ import json import os import sys -from typing import Any, Callable, Dict, List, Optional +from typing import Any, Callable, Dict, List, Optional, cast import fiona import fiona.transform @@ -307,7 +307,7 @@ def __getitem__(self, query: BoundingBox) -> Dict[str, Any]: IndexError: if query is not found in the index """ hits = self.index.intersection(tuple(query), objects=True) - filepaths = [hit.object for hit in hits] + filepaths = cast(List[str], [hit.object for hit in hits]) if not filepaths: raise IndexError( From 48f516ff8a0f30d3932868cc738ae40573ae5697 Mon Sep 17 00:00:00 2001 From: Michael Nolde Date: Fri, 14 Oct 2022 02:20:43 +0200 Subject: [PATCH 7/7] explicitly convert image tensor to numpy before plotting (#845) Co-authored-by: Michael Nolde --- docs/tutorials/custom_raster_dataset.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/custom_raster_dataset.ipynb b/docs/tutorials/custom_raster_dataset.ipynb index e4dd0c304eb..9e8a86ec9cd 100644 --- a/docs/tutorials/custom_raster_dataset.ipynb +++ b/docs/tutorials/custom_raster_dataset.ipynb @@ -3382,7 +3382,7 @@ "\n", " # Reorder and rescale the image\n", " image = sample[\"image\"][rgb_indices].permute(1, 2, 0)\n", - " image = torch.clamp(image / 6000, min=0, max=1)\n", + " image = torch.clamp(image / 6000, min=0, max=1).numpy()\n", "\n", " # Plot the image\n", " fig, ax = plt.subplots()\n",