Skip to content

Commit

Permalink
ZueriCrop: rehost on HF
Browse files Browse the repository at this point in the history
  • Loading branch information
adamjstewart committed Jan 20, 2025
1 parent 68e0cfe commit 1be1052
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 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 @@ -62,4 +62,4 @@ Dataset,Task,Source,License,# Samples,# Classes,Size (px),Resolution (m),Bands
`VHR-10`_,I,"Google Earth, Vaihingen","MIT",800,10,"358--1,728",0.08--2,RGB
`Western USA Live Fuel Moisture`_,R,"Landsat8, Sentinel-1","CC-BY-NC-ND-4.0",2615,-,-,-,-
`xView2`_,CD,Maxar,"CC-BY-NC-SA-4.0","3,732",4,"1,024x1,024",0.8,RGB
`ZueriCrop`_,"I, T",Sentinel-2,-,116K,48,24x24,10,MSI
`ZueriCrop`_,"I, T",Sentinel-2,CC-BY-NC-4.0,116K,48,24x24,10,MSI
12 changes: 3 additions & 9 deletions tests/datasets/test_zuericrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,11 @@
class TestZueriCrop:
@pytest.fixture
def dataset(self, monkeypatch: MonkeyPatch, tmp_path: Path) -> ZueriCrop:
data_dir = os.path.join('tests', 'data', 'zuericrop')
urls = [
os.path.join(data_dir, 'ZueriCrop.hdf5'),
os.path.join(data_dir, 'labels.csv'),
]
md5s = ['1635231df67f3d25f4f1e62c98e221a4', '5118398c7a5bbc246f5f6bb35d8d529b']
monkeypatch.setattr(ZueriCrop, 'urls', urls)
monkeypatch.setattr(ZueriCrop, 'md5s', md5s)
url = os.path.join('tests', 'data', 'zuericrop') + os.sep
monkeypatch.setattr(ZueriCrop, 'url', url)
root = tmp_path
transforms = nn.Identity()
return ZueriCrop(root=root, transforms=transforms, download=True, checksum=True)
return ZueriCrop(root=root, transforms=transforms, download=True)

def test_getitem(self, dataset: ZueriCrop) -> None:
x = dataset[0]
Expand Down
9 changes: 3 additions & 6 deletions torchgeo/datasets/zuericrop.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ class ZueriCrop(NonGeoDataset):
* `h5py <https://pypi.org/project/h5py/>`_ to load the dataset
"""

urls = (
'https://polybox.ethz.ch/index.php/s/uXfdr2AcXE3QNB6/download',
'https://raw.githubusercontent.com/0zgur0/multi-stage-convSTAR-network/fa92b5b3cb77f5171c5c3be740cd6e6395cc29b6/labels.csv',
)
url = 'https://hf.co/datasets/torchgeo/zuericrop/resolve/8ac0f416fbaab032d8670cc55f984b9f079e86b2/'
md5s = ('1635231df67f3d25f4f1e62c98e221a4', '5118398c7a5bbc246f5f6bb35d8d529b')
filenames = ('ZueriCrop.hdf5', 'labels.csv')

Expand Down Expand Up @@ -221,11 +218,11 @@ def _verify(self) -> None:

def _download(self) -> None:
"""Download the dataset."""
for url, filename, md5 in zip(self.urls, self.filenames, self.md5s):
for filename, md5 in zip(self.filenames, self.md5s):
filepath = os.path.join(self.root, filename)
if not os.path.exists(filepath):
download_url(
url,
self.url + filename,
self.root,
filename=filename,
md5=md5 if self.checksum else None,
Expand Down

0 comments on commit 1be1052

Please sign in to comment.