Skip to content

Commit 1ebeeb5

Browse files
Merge pull request #32 from IBM/feature/dependabot
Feature/refactor + dependabot
2 parents 9d3da72 + 0068b3a commit 1ebeeb5

File tree

92 files changed

+169
-59
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

92 files changed

+169
-59
lines changed

.github/workflows/test.yaml

+13-5
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
name: terratorch tuning toolkit
22

3-
on: [pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
pull_request:
9+
branches:
10+
- main
411

512
jobs:
613
build:
7-
814
runs-on: ubuntu-latest
915
strategy:
1016
matrix:
1117
python-version: ["3.10", "3.11"]
1218

1319
steps:
14-
- uses: actions/checkout@v3
20+
- name: Clone repo
21+
uses: actions/checkout@v3
1522
- name: Set up Python ${{ matrix.python-version }}
1623
uses: actions/setup-python@v4
1724
with:
@@ -20,8 +27,9 @@ jobs:
2027
- name: Install dependencies
2128
run: |
2229
python -m pip install --upgrade pip
23-
pip install pytest
24-
pip install -e .
30+
pip install -r requirements/required.txt -r requirements/test.txt
31+
- name: List pip dependencies
32+
run: pip list
2533
- name: Test with pytest
2634
run: |
2735
pytest -s tests

README.md

+1-1

pyproject.toml

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ classifiers = [
2626
"Programming Language :: Python :: Implementation :: PyPy",
2727
]
2828
dependencies = [
29-
"coverage",
30-
"pytest",
3129
"torch>=2.1.0",
3230
"torchvision>=0.16.0",
3331
"torchgeo>=0.5.1",
@@ -50,6 +48,11 @@ dev = [
5048
"mkdocstrings[python]"
5149
]
5250

51+
test = [
52+
"coverage",
53+
"pytest"
54+
]
55+
5356
[project.urls]
5457
Documentation = "https://github.com/IBM/terratorch#readme"
5558
Issues = "https://github.com/IBM/terratorch/issues"

requirements-dev.txt requirements/dev.txt

-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
coverage[toml]>=6.5
2-
pytest-cov==4.1.0
3-
pytest==7.4.3
41
mkdocs-material==9.4.14
52
mkdocstrings[python]
63
h5py==3.10.0
File renamed without changes.

requirements/test.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage[toml]>=6.5
2+
pytest-cov==4.1.0
3+
pytest==7.4.3

src/terratorch/models/backbones/__init__.py

-3
This file was deleted.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
# register models with timm
24
import terratorch.models
35
from terratorch.models.backbones import * # noqa: F403

src/terratorch/__main__.py terratorch/__main__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""Command-line interface to TerraTorch."""
24

35
from terratorch.cli_tools import build_lightning_cli

src/terratorch/cli_tools.py terratorch/cli_tools.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
import logging # noqa: I001
24
import os
35
import warnings

src/terratorch/datamodules/__init__.py terratorch/datamodules/__init__.py

+14-12
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from terratorch.datamodules.fire_scars import FireScarsNonGeoDataModule
24
from terratorch.datamodules.generic_pixel_wise_data_module import (
35
GenericNonGeoPixelwiseRegressionDataModule,
@@ -6,26 +8,26 @@
68
from terratorch.datamodules.generic_scalar_label_data_module import (
79
GenericNonGeoClassificationDataModule,
810
)
9-
10-
# GenericNonGeoRegressionDataModule,
11-
from terratorch.datamodules.sen1floods11 import Sen1Floods11NonGeoDataModule
12-
from terratorch.datamodules.torchgeo_data_module import TorchGeoDataModule, TorchNonGeoDataModule
13-
14-
# geobench classification datamodules
15-
from terratorch.datamodules.m_eurosat import MEuroSATNonGeoDataModule
1611
from terratorch.datamodules.m_bigearthnet import MBigEarthNonGeoDataModule
1712
from terratorch.datamodules.m_brick_kiln import MBrickKilnNonGeoDataModule
18-
from terratorch.datamodules.m_forestnet import MForestNetNonGeoDataModule
19-
from terratorch.datamodules.m_so2sat import MSo2SatNonGeoDataModule
20-
from terratorch.datamodules.m_pv4ger import MPv4gerNonGeoDataModule
2113

2214
# geobench segmentation datamodules
2315
from terratorch.datamodules.m_cashew_plantation import MBeninSmallHolderCashewsNonGeoDataModule
24-
from terratorch.datamodules.m_nz_cattle import MNzCattleNonGeoDataModule
2516
from terratorch.datamodules.m_chesapeake_landcover import MChesapeakeLandcoverNonGeoDataModule
17+
18+
# geobench classification datamodules
19+
from terratorch.datamodules.m_eurosat import MEuroSATNonGeoDataModule
20+
from terratorch.datamodules.m_forestnet import MForestNetNonGeoDataModule
21+
from terratorch.datamodules.m_neontree import MNeonTreeNonGeoDataModule
22+
from terratorch.datamodules.m_nz_cattle import MNzCattleNonGeoDataModule
23+
from terratorch.datamodules.m_pv4ger import MPv4gerNonGeoDataModule
2624
from terratorch.datamodules.m_pv4ger_seg import MPv4gerSegNonGeoDataModule
2725
from terratorch.datamodules.m_SA_crop_type import MSACropTypeNonGeoDataModule
28-
from terratorch.datamodules.m_neontree import MNeonTreeNonGeoDataModule
26+
from terratorch.datamodules.m_so2sat import MSo2SatNonGeoDataModule
27+
28+
# GenericNonGeoRegressionDataModule,
29+
from terratorch.datamodules.sen1floods11 import Sen1Floods11NonGeoDataModule
30+
from terratorch.datamodules.torchgeo_data_module import TorchGeoDataModule, TorchNonGeoDataModule
2931

3032
__all__ = (
3133
"GenericNonGeoSegmentationDataModule",

src/terratorch/datamodules/fire_scars.py terratorch/datamodules/fire_scars.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from typing import Any
24

35
import kornia.augmentation as K # noqa: N812

src/terratorch/datamodules/generic_pixel_wise_data_module.py terratorch/datamodules/generic_pixel_wise_data_module.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""
24
This module contains generic data modules for instantiation at runtime.
35
"""

src/terratorch/datamodules/generic_scalar_label_data_module.py terratorch/datamodules/generic_scalar_label_data_module.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""
24
This module contains generic data modules for instantiation at runtime.
35
"""
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/terratorch/datamodules/sen1floods11.py terratorch/datamodules/sen1floods11.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from pathlib import Path
24
from typing import Any
35

src/terratorch/datamodules/torchgeo_data_module.py terratorch/datamodules/torchgeo_data_module.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""Ugly proxy objects so parsing config file works with transforms.
24
35
These are necessary since, for LightningCLI to instantiate arguments as

src/terratorch/datamodules/utils.py terratorch/datamodules/utils.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
import albumentations as A
1+
# Copyright contributors to the Terratorch project
2+
23
from typing import Iterable
34

5+
import albumentations as A
6+
47

58
def wrap_in_compose_is_list(transform_list):
69
# set check shapes to false because of the multitemporal case

src/terratorch/datasets/__init__.py terratorch/datasets/__init__.py

+17-15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from terratorch.datasets.fire_scars import FireScarsHLS, FireScarsNonGeo, FireScarsSegmentationMask
24
from terratorch.datasets.generic_pixel_wise_dataset import (
35
GenericNonGeoPixelwiseRegressionDataset,
@@ -6,30 +8,30 @@
68
from terratorch.datasets.generic_scalar_label_dataset import (
79
GenericNonGeoClassificationDataset,
810
)
9-
10-
# GenericNonGeoRegressionDataset,
11-
from terratorch.datasets.sen1floods11 import Sen1Floods11NonGeo
12-
from terratorch.datasets.utils import HLSBands
13-
14-
# TorchGeo RasterDatasets
15-
from terratorch.datasets.wsf import WSF2019, WSFEvolution
1611
from terratorch.datasets.hls import HLSL30, HLSS30
17-
18-
# geobench datasets classification
19-
from terratorch.datasets.m_eurosat import MEuroSATNonGeo
2012
from terratorch.datasets.m_bigearthnet import MBigEarthNonGeo
2113
from terratorch.datasets.m_brick_kiln import MBrickKilnNonGeo
22-
from terratorch.datasets.m_forestnet import MForestNetNonGeo
23-
from terratorch.datasets.m_so2sat import MSo2SatNonGeo
24-
from terratorch.datasets.m_pv4ger import MPv4gerNonGeo
2514

2615
# geobench datasets segmentation
2716
from terratorch.datasets.m_cashew_plantation import MBeninSmallHolderCashewsNonGeo
28-
from terratorch.datasets.m_nz_cattle import MNzCattleNonGeo
2917
from terratorch.datasets.m_chesapeake_landcover import MChesapeakeLandcoverNonGeo
18+
19+
# geobench datasets classification
20+
from terratorch.datasets.m_eurosat import MEuroSATNonGeo
21+
from terratorch.datasets.m_forestnet import MForestNetNonGeo
22+
from terratorch.datasets.m_neontree import MNeonTreeNonGeo
23+
from terratorch.datasets.m_nz_cattle import MNzCattleNonGeo
24+
from terratorch.datasets.m_pv4ger import MPv4gerNonGeo
3025
from terratorch.datasets.m_pv4ger_seg import MPv4gerSegNonGeo
3126
from terratorch.datasets.m_SA_crop_type import MSACropTypeNonGeo
32-
from terratorch.datasets.m_neontree import MNeonTreeNonGeo
27+
from terratorch.datasets.m_so2sat import MSo2SatNonGeo
28+
29+
# GenericNonGeoRegressionDataset,
30+
from terratorch.datasets.sen1floods11 import Sen1Floods11NonGeo
31+
from terratorch.datasets.utils import HLSBands
32+
33+
# TorchGeo RasterDatasets
34+
from terratorch.datasets.wsf import WSF2019, WSFEvolution
3335

3436
__all__ = (
3537
"GenericNonGeoSegmentationDataset",

src/terratorch/datasets/fire_scars.py terratorch/datasets/fire_scars.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
import dataclasses
24
import glob
35
import os

src/terratorch/datasets/generic_pixel_wise_dataset.py terratorch/datasets/generic_pixel_wise_dataset.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""Module containing generic dataset classes
24
"""
35
import glob

src/terratorch/datasets/generic_scalar_label_dataset.py terratorch/datasets/generic_scalar_label_dataset.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""Module containing generic dataset classes
24
"""
35
import glob

src/terratorch/datasets/hls.py terratorch/datasets/hls.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
# Copyright (c) IBM Corp. All rights reserved.
2-
# Licensed under the MIT License.
1+
# Copyright contributors to the Terratorch project
2+
33

44
"""Harmonized Landsat and Sentinel-2 datasets."""
55

66
import abc
77
from collections.abc import Iterable, Sequence
8+
from typing import Any, Callable, Optional, Union
9+
810
from rasterio.crs import CRS
911
from torchgeo.datasets import Landsat
10-
from typing import Any, Callable, Optional, Union
1112

1213

1314
class HLS(Landsat, abc.ABC):
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

src/terratorch/datasets/sen1floods11.py terratorch/datasets/sen1floods11.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
import dataclasses
24
import glob
35
import os

src/terratorch/datasets/transforms.py terratorch/datasets/transforms.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from albumentations import BasicTransform, Compose, ImageOnlyTransform
24
from einops import rearrange
35
from torch import Tensor

src/terratorch/datasets/utils.py terratorch/datasets/utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
import os
24
from collections.abc import Iterator
35
from enum import Enum

src/terratorch/datasets/wsf.py terratorch/datasets/wsf.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
# Copyright (c) IBM Corp. All rights reserved.
2-
# Licensed under the MIT License.
1+
# Copyright contributors to the Terratorch project
2+
33

44
"""World Settlement Footprint datasets."""
55

66
import abc
7+
from collections.abc import Iterable, Sequence
8+
from typing import Any, Callable, Optional, Union
9+
710
import matplotlib.pyplot as plt
811
import numpy as np
9-
10-
from collections.abc import Iterable, Sequence
1112
from rasterio.crs import CRS
1213
from torchgeo.datasets import RasterDataset
13-
from typing import Any, Callable, Optional, Union
1414

1515

1616
class WSF(RasterDataset, abc.ABC):
File renamed without changes.

src/terratorch/models/__init__.py terratorch/models/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from terratorch.models.prithvi_model_factory import PrithviModelFactory
24
from terratorch.models.satmae_model_factory import SatMAEModelFactory
35
from terratorch.models.scalemae_model_factory import ScaleMAEModelFactory
+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
3+
# import so they get registered
4+
import terratorch.models.backbones.prithvi_swin
5+
import terratorch.models.backbones.prithvi_vit

src/terratorch/models/backbones/prithvi_select_patch_embed_weights.py terratorch/models/backbones/prithvi_select_patch_embed_weights.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
import logging
24

35
import torch

src/terratorch/models/backbones/prithvi_swin.py terratorch/models/backbones/prithvi_swin.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""This module handles registering prithvi_swin models into timm.
24
"""
35

src/terratorch/models/backbones/prithvi_vit.py terratorch/models/backbones/prithvi_vit.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Copyright (c) IBM Corp. All rights reserved.
2-
# Licensed under the MIT License.
1+
# Copyright contributors to the Terratorch project
2+
33

44
import logging
55
from functools import partial

src/terratorch/models/backbones/swin_encoder_decoder.py terratorch/models/backbones/swin_encoder_decoder.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""Swin transformer implementation. Mix of MMSegmentation implementation and timm implementation.
24
35
We use this implementation instead of the original implementation or timm's.

src/terratorch/models/backbones/vit_encoder_decoder.py terratorch/models/backbones/vit_encoder_decoder.py

+3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
# DeiT: https://github.com/facebookresearch/deit
77
# --------------------------------------------------------
88

9+
# Copyright contributors to the Terratorch project
10+
11+
912
from functools import lru_cache
1013

1114
import numpy as np
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from terratorch.models.decoders.fcn_decoder import FCNDecoder
24
from terratorch.models.decoders.identity_decoder import IdentityDecoder
3-
from terratorch.models.decoders.upernet_decoder import UperNetDecoder
45
from terratorch.models.decoders.satmae_head import SatMAEHead, SatMAEHeadViT
6+
from terratorch.models.decoders.upernet_decoder import UperNetDecoder
57

68
__all__ = ["FCNDecoder", "UperNetDecoder", "IdentityDecoder", "SatMAEHead", "SatMAEHeadViT"]

src/terratorch/models/decoders/fcn_decoder.py terratorch/models/decoders/fcn_decoder.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
from torch import Tensor, nn
24

35

src/terratorch/models/decoders/identity_decoder.py terratorch/models/decoders/identity_decoder.py

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Copyright contributors to the Terratorch project
2+
13
"""Pass the features straight through
24
"""
35

0 commit comments

Comments
 (0)