Skip to content

Commit 63bdb76

Browse files
datumboxfacebook-github-bot
authored andcommitted
[fbsync] fix eurosat prototype mock data setup (#5549)
Summary: * [DEBUG] eurosat prototype on windows and macos * print paths * fix eurosat mock data setup * revert changes * minor cleanup Reviewed By: vmoens Differential Revision: D34878969 fbshipit-source-id: 6784c6119b65ec719683195e7d1ebbf22a9d1b2d
1 parent daa694f commit 63bdb76

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

test/builtin_dataset_mocks.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,20 +1329,20 @@ def cub200(info, root, config):
13291329

13301330
@register_mock
13311331
def eurosat(info, root, config):
1332-
data_folder = pathlib.Path(root, "eurosat", "2750")
1332+
data_folder = root / "2750"
13331333
data_folder.mkdir(parents=True)
13341334

13351335
num_examples_per_class = 3
1336-
classes = ("AnnualCrop", "Forest")
1337-
for cls in classes:
1336+
categories = ["AnnualCrop", "Forest"]
1337+
for category in categories:
13381338
create_image_folder(
13391339
root=data_folder,
1340-
name=cls,
1341-
file_name_fn=lambda idx: f"{cls}_{idx}.jpg",
1340+
name=category,
1341+
file_name_fn=lambda idx: f"{category}_{idx + 1}.jpg",
13421342
num_examples=num_examples_per_class,
13431343
)
13441344
make_zip(root, "EuroSAT.zip", data_folder)
1345-
return len(classes) * num_examples_per_class
1345+
return len(categories) * num_examples_per_class
13461346

13471347

13481348
@register_mock

test/test_prototype_builtin_datasets.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def test_sample(self, test_home, dataset_mock, config):
5353

5454
try:
5555
sample = next(iter(dataset))
56+
except StopIteration:
57+
raise AssertionError("Unable to draw any sample.") from None
5658
except Exception as error:
5759
raise AssertionError("Drawing a sample raised the error above.") from error
5860

0 commit comments

Comments
 (0)