Skip to content

Commit

Permalink
Fixes 4 ai4smallfarms
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Brune committed Nov 7, 2024
1 parent ac3a667 commit cf59075
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
9 changes: 4 additions & 5 deletions configs/dataset/ai4smallfarms.yaml
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
_target_: pangaea.datasets.ai4smallfarms.AI4SmallFarms
dataset_name: AI4SmallFarms
root_path: ./data/ai4smallfarms
dataverse_api_token: 753e72e8-c746-4860-9d0c-3aec872d888a
download_url: https://phys-techsciences.datastations.nl
auto_download: True

img_size: 807
img_size: 496
multi_temporal: False
multi_modal: False
limited_label: False

ignore_index: -1
num_classes: 2
num_classes: 1
classes:
- Background
- Crop Field
Expand Down Expand Up @@ -52,4 +51,4 @@ data_min:
- 1.0
- 9.0
- 1.0
- 66.0
- 66.0
20 changes: 11 additions & 9 deletions pangaea/datasets/ai4smallfarms.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def download(self, silent=False):
return

# Set up the Dataverse API
base_url = "https://phys-techsciences.datastations.nl"
base_url = self.download_url
api = NativeApi(base_url)
data_api = DataAccessApi(base_url)
DOI = "doi:10.17026/dans-xy6-ngg6"
Expand Down Expand Up @@ -205,19 +205,19 @@ def download(self, silent=False):

# **Cleanup: Remove unwanted files and directories**
unwanted_paths = [
os.path.join(dataset_config["root_path"], "easy-migration.zip"),
os.path.join(dataset_config["root_path"], "readme.md"),
os.path.join(self.root_path, "easy-migration.zip"),
os.path.join(self.root_path, "readme.md"),
os.path.join(
dataset_config["root_path"], "sentinel-2-asia", "benchmark.qgz"
self.root_path, "sentinel-2-asia", "benchmark.qgz"
),
os.path.join(
dataset_config["root_path"], "sentinel-2-asia", "tiles_asia.gpkg"
self.root_path, "sentinel-2-asia", "tiles_asia.gpkg"
),
os.path.join(dataset_config["root_path"], "sentinel-2-asia", "reference"),
os.path.join(self.root_path, "sentinel-2-asia", "reference"),
os.path.join(
dataset_config["root_path"], "sentinel-2-asia", "test", "output"
self.root_path, "sentinel-2-asia", "test", "output"
),
os.path.join(dataset_config["root_path"], "sentinel-2-nl"),
os.path.join(self.root_path, "sentinel-2-nl"),
]

# Remove unwanted files and directories
Expand All @@ -230,5 +230,7 @@ def download(self, silent=False):
if not silent:
print(f"Removed unwanted path: {path}")

os.rename(os.path.join(self.root_path, "sentinel-2-asia/validate"), os.path.join(self.root_path, "sentinel-2-asia/val"))

if not silent:
print(f"Downloaded dataset to {dataset_config['root_path']}")
print(f"Downloaded dataset to {self.root_path}")

0 comments on commit cf59075

Please sign in to comment.