Unverified Commit 7bb8186c authored by Philip Meier's avatar Philip Meier Committed by GitHub
Browse files

fix eurosat prototype mock data setup (#5549)

* [DEBUG] eurosat prototype on windows and macos

* print paths

* fix eurosat mock data setup

* revert changes

* minor cleanup
parent 27745e5b
...@@ -1329,20 +1329,20 @@ def cub200(info, root, config): ...@@ -1329,20 +1329,20 @@ def cub200(info, root, config):
@register_mock @register_mock
def eurosat(info, root, config): def eurosat(info, root, config):
data_folder = pathlib.Path(root, "eurosat", "2750") data_folder = root / "2750"
data_folder.mkdir(parents=True) data_folder.mkdir(parents=True)
num_examples_per_class = 3 num_examples_per_class = 3
classes = ("AnnualCrop", "Forest") categories = ["AnnualCrop", "Forest"]
for cls in classes: for category in categories:
create_image_folder( create_image_folder(
root=data_folder, root=data_folder,
name=cls, name=category,
file_name_fn=lambda idx: f"{cls}_{idx}.jpg", file_name_fn=lambda idx: f"{category}_{idx + 1}.jpg",
num_examples=num_examples_per_class, num_examples=num_examples_per_class,
) )
make_zip(root, "EuroSAT.zip", data_folder) make_zip(root, "EuroSAT.zip", data_folder)
return len(classes) * num_examples_per_class return len(categories) * num_examples_per_class
@register_mock @register_mock
......
...@@ -53,6 +53,8 @@ class TestCommon: ...@@ -53,6 +53,8 @@ class TestCommon:
try: try:
sample = next(iter(dataset)) sample = next(iter(dataset))
except StopIteration:
raise AssertionError("Unable to draw any sample.") from None
except Exception as error: except Exception as error:
raise AssertionError("Drawing a sample raised the error above.") from error raise AssertionError("Drawing a sample raised the error above.") from error
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment