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

Add multiple versions of the So2Sat dataset #1283

Merged
merged 22 commits into from
Apr 25, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Update tests
  • Loading branch information
calebrob6 committed Apr 24, 2023
commit c846d3ff8b05ca0c95e7210d653e7469f61fae0f
12 changes: 7 additions & 5 deletions tests/datasets/test_so2sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
class TestSo2Sat:
@pytest.fixture(params=["train", "validation", "test"])
def dataset(self, monkeypatch: MonkeyPatch, request: SubRequest) -> So2Sat:
md5s = {
"train": "82e0f2d51766b89cb905dbaf8275eb5b",
"validation": "bf292ae4737c1698b1a3c6f5e742e0e1",
"test": "9a3bbe181b038d4e51f122c4be3c569e",
md5s_by_version = {
"2": {
"train": "82e0f2d51766b89cb905dbaf8275eb5b",
"validation": "bf292ae4737c1698b1a3c6f5e742e0e1",
"test": "9a3bbe181b038d4e51f122c4be3c569e",
}
}

monkeypatch.setattr(So2Sat, "md5s", md5s)
monkeypatch.setattr(So2Sat, "md5s_by_version", md5s_by_version)
root = os.path.join("tests", "data", "so2sat")
split = request.param
transforms = nn.Identity()
Expand Down
25 changes: 7 additions & 18 deletions torchgeo/datasets/so2sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,44 +82,33 @@ class So2Sat(NonGeoDataset):

or manually downloaded from https://mediatum.ub.tum.de/1613658
""" # noqa: E501

versions = ["2", "3_random", "3_block", "3_culture_10"]
filenames_by_version = {
"2": {
"train": "training.h5",
"validation": "validation.h5",
"test": "testing.h5",
},
"3_random": {
"train": "random/training.h5",
"test": "random/testing.h5",
},
"3_block": {
"train": "block/training.h5",
"test": "block/testing.h5",
},
"3_random": {"train": "random/training.h5", "test": "random/testing.h5"},
"3_block": {"train": "block/training.h5", "test": "block/testing.h5"},
"3_culture_10": {
"train": "culture_10/training.h5",
"test": "culture_10/testing.h5",
}
},
}
md5s_by_version = {
"2": {
"train": "702bc6a9368ebff4542d791e53469244",
"validation": "71cfa6795de3e22207229d06d6f8775d",
"test": "e81426102b488623a723beab52b31a8a",
},
"3_random": {
"train": "",
"test": "",
},
"3_block": {
"train": "",
"test": "",
},
"3_random": {"train": "", "test": ""},
"3_block": {"train": "", "test": ""},
"3_culture_10": {
"train": "702bc6a9368ebff4542d791e53469244",
"test": "58335ce34ca3a18424e19da84f2832fc",
}
},
}

classes = [
Expand Down