Skip to content

Commit

Permalink
Update new SSL4EO dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Apr 15, 2023
1 parent 78609f5 commit 252e385
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/data/ssl4eo/s12/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import hashlib
import os
import shutil
from typing import Dict, List, Union
from typing import Union

import numpy as np
import rasterio
Expand All @@ -17,7 +17,7 @@

np.random.seed(0)

FILENAME_HIERARCHY = Union[Dict[str, "FILENAME_HIERARCHY"], List[str]]
FILENAME_HIERARCHY = Union[dict[str, "FILENAME_HIERARCHY"], list[str]]

s1 = ["VH.tif", "VV.tif"]
s2c = [
Expand Down
8 changes: 4 additions & 4 deletions torchgeo/datasets/ssl4eo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import os
import random
from typing import Callable, Dict, Optional, cast
from typing import Callable, Optional, cast

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -101,7 +101,7 @@ def __init__(
root: str = "data",
split: str = "s2c",
seasons: int = 1,
transforms: Optional[Callable[[Dict[str, Tensor]], Dict[str, Tensor]]] = None,
transforms: Optional[Callable[[dict[str, Tensor]], dict[str, Tensor]]] = None,
checksum: bool = False,
) -> None:
"""Initialize a new SSL4EOS12 instance.
Expand Down Expand Up @@ -133,7 +133,7 @@ def __init__(

self._verify()

def __getitem__(self, index: int) -> Dict[str, Tensor]:
def __getitem__(self, index: int) -> dict[str, Tensor]:
"""Return an index within the dataset.
Args:
Expand Down Expand Up @@ -198,7 +198,7 @@ def _extract(self) -> None:

def plot(
self,
sample: Dict[str, Tensor],
sample: dict[str, Tensor],
show_titles: bool = True,
suptitle: Optional[str] = None,
) -> plt.Figure:
Expand Down

0 comments on commit 252e385

Please sign in to comment.