Skip to content

Commit

Permalink
mypy and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
nilsleh committed Jan 20, 2025
1 parent 0028c9a commit 49a1ba1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/api/datasets/non_geo_datasets.csv
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Dataset,Task,Source,License,# Samples,# Classes,Size (px),Resolution (m),Bands
`Benin Cashew Plantations`_,S,Airbus Pléiades,"CC-BY-4.0",70,6,"1,122x1,186",10,MSI
`BigEarthNet`_,C,Sentinel-1/2,"CDLA-Permissive-1.0","590,326",19--43,120x120,10,"SAR, MSI"
`BioMassters`_,R,Sentinel-1/2 and Lidar,"CC-BY-4.0",,,256x256, 10, "SAR, MSI"
`BRIGHT`_,CD,"MAXAR, NAIP, Capella, Umbra","CC-BY-SA-4.0",3239,4,"0.1-1","RGB,SAR"
`BRIGHTDFC2025`_,CD,"MAXAR, NAIP, Capella, Umbra","CC-BY-SA-4.0",3239,4,"0.1-1","RGB,SAR"
`CaBuAr`_,CD,Sentinel-2,"OpenRAIL",424,2,512x512,20,MSI
`CaFFe`_,S,"Sentinel-1, TerraSAR-X, TanDEM-X, ENVISAT, ERS-1/2, ALOS PALSAR, and RADARSAT-1","CC-BY-4.0","19092","2 or 4","512x512",6-20,"SAR"
`ChaBuD`_,CD,Sentinel-2,"OpenRAIL",356,2,512x512,10,MSI
Expand Down
14 changes: 9 additions & 5 deletions torchgeo/datasets/bright.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

from .errors import DatasetNotFoundError
from .geo import NonGeoDataset
from .utils import Path, download_url, extract_archive
from .utils import Path, download_url, extract_archive, check_integrity


class BRIGHTDFC2025(NonGeoDataset):
Expand Down Expand Up @@ -147,8 +147,12 @@ def __getitem__(self, index: int) -> dict[str, Tensor]:

return sample

def _get_paths(self) -> tuple[list[Path], list[Path], list[Path]]:
"""Get paths to the dataset files based on specified splits."""
def _get_paths(self) -> list[dict[str, str]]:
"""Get paths to the dataset files based on specified splits.
Returns:
a list of dictionaries containing paths to the pre,post and target images
"""
split_file = self.split_files[self.split]

file_path = os.path.join(self.root, self.data_dir, split_file)
Expand Down Expand Up @@ -212,7 +216,7 @@ def _verify(self) -> None:
exists = []
zip_file_path = os.path.join(self.root, self.data_dir + '.zip')
if os.path.exists(zip_file_path):
if self.checksum and not check_integrity(zip_file_path, split_info['md5']):
if self.checksum and not check_integrity(zip_file_path, self.md5):
raise RuntimeError('Dataset found, but corrupted.')
exists.append(True)
extract_archive(zip_file_path, self.root)
Expand Down Expand Up @@ -257,7 +261,7 @@ def _load_image(self, path: Path) -> Tensor:
"""
with rasterio.open(path) as src:
img = src.read()
tensor = torch.from_numpy(img).float()
tensor: Tensor = torch.from_numpy(img).float()
return tensor

def plot(
Expand Down

0 comments on commit 49a1ba1

Please sign in to comment.