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
Adding datamodule
  • Loading branch information
calebrob6 committed Apr 25, 2023
commit 09926fc126b8f497df66420bcd69ffe0b749bc67
1 change: 1 addition & 0 deletions tests/conf/so2sat_all.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ datamodule:
root: "tests/data/so2sat"
batch_size: 1
num_workers: 0
version: "2"
band_set: "all"
17 changes: 17 additions & 0 deletions tests/conf/so2sat_rgb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module:
_target_: torchgeo.trainers.ClassificationTask
loss: "ce"
model: "resnet18"
learning_rate: 1e-3
learning_rate_schedule_patience: 6
weights: null
in_channels: 3
num_classes: 17

datamodule:
_target_: torchgeo.datamodules.So2SatDataModule
root: "tests/data/so2sat"
batch_size: 1
num_workers: 0
version: "3_random"
band_set: "rgb"
1 change: 1 addition & 0 deletions tests/conf/so2sat_s1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ datamodule:
root: "tests/data/so2sat"
batch_size: 1
num_workers: 0
version: "2"
band_set: "s1"
1 change: 1 addition & 0 deletions tests/conf/so2sat_s2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ datamodule:
root: "tests/data/so2sat"
batch_size: 1
num_workers: 0
version: "2"
band_set: "s2"
1 change: 1 addition & 0 deletions tests/trainers/test_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class TestClassificationTask:
"so2sat_all",
"so2sat_s1",
"so2sat_s2",
"so2sat_rgb",
"ucmerced",
],
)
Expand Down
92 changes: 88 additions & 4 deletions torchgeo/datamodules/so2sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,50 @@ class So2SatDataModule(NonGeoDataModule):
0.10905050699570,
]
),
"3_random": torch.tensor([]),
"3_block": torch.tensor([]),
"3_random": torch.tensor(
[
-0.00005541164581,
-0.00001363245448,
0.00004558943283,
0.00002990907940,
0.04451951629749,
0.25862310103671,
0.00032720731137,
0.00123416595462,
0.12428656593186,
0.11001677362564,
0.10230652367417,
0.11532195526186,
0.15989486018315,
0.18204406482475,
0.17513562590622,
0.19565546643221,
0.15648722649020,
0.11122536338577,
]
),
"3_block": torch.tensor(
[
-0.00004632368791,
0.00001260869365,
0.00005305557337,
0.00003471369557,
0.04449937686171,
0.26046026815721,
0.00087815394475,
0.00086889627435,
0.12381869777901,
0.10944155483024,
0.10176911573221,
0.11465267892206,
0.15870528223797,
0.18053964470203,
0.17366821871719,
0.19390983961551,
0.15536490486611,
0.11057334452833,
]
),
"3_culture_10": torch.tensor( # note: this is the same as "2"
[
-0.00003591224260,
Expand Down Expand Up @@ -93,8 +135,50 @@ class So2SatDataModule(NonGeoDataModule):
0.08780632,
]
),
"3_random": torch.tensor([]),
"3_block": torch.tensor([]),
"3_random": torch.tensor(
[
0.1756914,
0.1761190,
0.4600589,
0.4563601,
2.2492179,
7.9056503,
2.1917633,
1.3148480,
0.0392269,
0.0470917,
0.0653264,
0.0624057,
0.0758367,
0.0891717,
0.0905092,
0.0996856,
0.0990188,
0.0873386,
]
),
"3_block": torch.tensor(
[
0.1751797,
0.1754073,
0.4610124,
0.4572122,
0.8294254,
7.1771026,
0.9642598,
0.8770835,
0.0388311,
0.0464986,
0.0643833,
0.0616141,
0.0753004,
0.0886178,
0.0899500,
0.0991759,
0.0983276,
0.0865943,
]
),
"3_culture_10": torch.tensor( # note: this is the same as "2"
[
0.17555201,
Expand Down
5 changes: 4 additions & 1 deletion torchgeo/datasets/so2sat.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,10 @@ class So2Sat(NonGeoDataset):
"train": "94e2e2e667b406c2adf61e113b42204e",
"test": "1e15c425585ce816342d1cd779d453d8",
},
"3_block": {"train": "", "test": ""},
"3_block": {
"train": "a91d6150e8b059dac86105853f377a11",
"test": "6414af1ec33ace417e879f9c88066d47"
},
"3_culture_10": {
"train": "702bc6a9368ebff4542d791e53469244",
"test": "58335ce34ca3a18424e19da84f2832fc",
Expand Down