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

0.5.0 release #1604

Merged
merged 7 commits into from
Sep 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[tests]
Expand All @@ -48,7 +48,7 @@ jobs:
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[datasets,tests]
Expand All @@ -74,7 +74,7 @@ jobs:
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[docs,tests] planetary_computer pystac
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tutorials.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
id: cache
with:
path: ${{ env.pythonLocation }}
key: ${{ env.pythonLocation }}-${{ hashFiles('setup.cfg') }}
key: ${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }}
- name: Install pip dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: pip install .[docs,tests] planetary_computer pystac
Expand Down
1 change: 1 addition & 0 deletions docs/tutorials/getting_started.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
"outputs": [],
"source": [
"chesapeake_root = os.path.join(tempfile.gettempdir(), \"chesapeake\")\n",
"os.makedirs(chesapeake_root, exist_ok=True)\n",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a bug in TorchGeo: #1605. Pretty minor so I don't think it's worth holding up the release for.

"chesapeake = ChesapeakeDE(chesapeake_root, crs=naip.crs, res=naip.res, download=True)"
]
},
Expand Down
1 change: 1 addition & 0 deletions tests/datasets/test_advance.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def test_mock_missing_module(
dataset[0]

def test_plot(self, dataset: ADVANCE) -> None:
pytest.importorskip("scipy", minversion="1.6.2")
x = dataset[0].copy()
dataset.plot(x, suptitle="Test")
plt.close()
Expand Down
2 changes: 2 additions & 0 deletions tests/datasets/test_skippd.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import torchgeo.datasets.utils
from torchgeo.datasets import SKIPPD

pytest.importorskip("h5py", minversion="3")


def download_url(url: str, root: str, *args: str, **kwargs: str) -> None:
shutil.copy(url, root)
Expand Down
3 changes: 3 additions & 0 deletions tests/trainers/test_detection.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
from torchgeo.main import main
from torchgeo.trainers import ObjectDetectionTask

# MAP metric requires pycocotools to be installed
pytest.importorskip("pycocotools")


class PredictObjectDetectionDataModule(NASAMarineDebrisDataModule):
def setup(self, stage: str) -> None:
Expand Down
24 changes: 10 additions & 14 deletions tests/trainers/test_moco.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,16 @@ def test_weight_str(self, mocked_weights: WeightsEnum) -> None:

@pytest.mark.slow
def test_weight_enum_download(self, weights: WeightsEnum) -> None:
match = "num classes .* != num classes in pretrained model"
with pytest.warns(UserWarning, match=match):
MoCoTask(
model=weights.meta["model"],
weights=weights,
in_channels=weights.meta["in_chans"],
)
MoCoTask(
model=weights.meta["model"],
weights=weights,
in_channels=weights.meta["in_chans"],
)

@pytest.mark.slow
def test_weight_str_download(self, weights: WeightsEnum) -> None:
match = "num classes .* != num classes in pretrained model"
with pytest.warns(UserWarning, match=match):
MoCoTask(
model=weights.meta["model"],
weights=str(weights),
in_channels=weights.meta["in_chans"],
)
MoCoTask(
model=weights.meta["model"],
weights=str(weights),
in_channels=weights.meta["in_chans"],
)
3 changes: 3 additions & 0 deletions tests/trainers/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ def create_model(*args: Any, **kwargs: Any) -> Module:
def test_trainer(
self, monkeypatch: MonkeyPatch, name: str, fast_dev_run: bool
) -> None:
if name == "skippd":
pytest.importorskip("h5py", minversion="3")

config = os.path.join("tests", "conf", name + ".yaml")

monkeypatch.setattr(timm, "create_model", self.create_model)
Expand Down
24 changes: 10 additions & 14 deletions tests/trainers/test_simclr.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,20 +126,16 @@ def test_weight_str(self, mocked_weights: WeightsEnum) -> None:

@pytest.mark.slow
def test_weight_enum_download(self, weights: WeightsEnum) -> None:
match = "num classes .* != num classes in pretrained model"
with pytest.warns(UserWarning, match=match):
SimCLRTask(
model=weights.meta["model"],
weights=weights,
in_channels=weights.meta["in_chans"],
)
SimCLRTask(
model=weights.meta["model"],
weights=weights,
in_channels=weights.meta["in_chans"],
)

@pytest.mark.slow
def test_weight_str_download(self, weights: WeightsEnum) -> None:
match = "num classes .* != num classes in pretrained model"
with pytest.warns(UserWarning, match=match):
SimCLRTask(
model=weights.meta["model"],
weights=str(weights),
in_channels=weights.meta["in_chans"],
)
SimCLRTask(
model=weights.meta["model"],
weights=str(weights),
in_channels=weights.meta["in_chans"],
)
2 changes: 1 addition & 1 deletion torchgeo/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@
"""

__author__ = "Adam J. Stewart"
__version__ = "0.5.0.dev0"
__version__ = "0.5.0"
2 changes: 1 addition & 1 deletion torchgeo/datamodules/chesapeake.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def __init__(
"""
# This is a rough estimate of how large of a patch we will need to sample in
# EPSG:3857 in order to guarantee a large enough patch in the local CRS.
self.original_patch_size = patch_size * 2
self.original_patch_size = patch_size * 3
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a heads up @calebrob6. Not sure what changed since the last release that made this necessary for the test to pass. We should really convert this to a normal RasterDataset.

kwargs["transforms"] = _Transform(K.CenterCrop(patch_size))

super().__init__(
Expand Down