Update BigEarthNet.py
Browse files- BigEarthNet.py +6 -5
BigEarthNet.py
CHANGED
|
@@ -9,7 +9,6 @@ import numpy as np
|
|
| 9 |
import pandas as pd
|
| 10 |
|
| 11 |
from tqdm import tqdm
|
| 12 |
-
from datasets.utils.extract import extract
|
| 13 |
|
| 14 |
class_sets = {
|
| 15 |
19: [
|
|
@@ -178,7 +177,8 @@ class BigEarthNetDataset(datasets.GeneratorBasedBuilder):
|
|
| 178 |
)
|
| 179 |
|
| 180 |
def _split_generators(self, dl_manager):
|
| 181 |
-
print(dl_manager.download_config.cache_dir)
|
|
|
|
| 182 |
# Ensure cache directory is set
|
| 183 |
if dl_manager.download_config.cache_dir is None:
|
| 184 |
return []
|
|
@@ -186,7 +186,8 @@ class BigEarthNetDataset(datasets.GeneratorBasedBuilder):
|
|
| 186 |
try:
|
| 187 |
downloaded_files = dl_manager.download(self.DATA_URL)
|
| 188 |
print(f"downloaded files: {downloaded_files}")
|
| 189 |
-
combined_file = os.path.join(dl_manager.download_config.cache_dir, "combined.tar.gz")
|
|
|
|
| 190 |
print(f"copying files to {combined_file}")
|
| 191 |
target_dir = os.path.dirname(combined_file)
|
| 192 |
os.makedirs(target_dir, exist_ok=True) # Create only the directory
|
|
@@ -198,8 +199,8 @@ class BigEarthNetDataset(datasets.GeneratorBasedBuilder):
|
|
| 198 |
shutil.copyfileobj(infile, outfile)
|
| 199 |
counter += 1
|
| 200 |
print(f"extacting from {combined_file}")
|
| 201 |
-
|
| 202 |
-
data_dir = extract(combined_file)
|
| 203 |
os.remove(combined_file)
|
| 204 |
print(f"data_dir: {data_dir}")
|
| 205 |
except Exception as e:
|
|
|
|
| 9 |
import pandas as pd
|
| 10 |
|
| 11 |
from tqdm import tqdm
|
|
|
|
| 12 |
|
| 13 |
class_sets = {
|
| 14 |
19: [
|
|
|
|
| 177 |
)
|
| 178 |
|
| 179 |
def _split_generators(self, dl_manager):
|
| 180 |
+
# print(dl_manager.download_config.cache_dir)
|
| 181 |
+
print(dl_manager.download_dir)
|
| 182 |
# Ensure cache directory is set
|
| 183 |
if dl_manager.download_config.cache_dir is None:
|
| 184 |
return []
|
|
|
|
| 186 |
try:
|
| 187 |
downloaded_files = dl_manager.download(self.DATA_URL)
|
| 188 |
print(f"downloaded files: {downloaded_files}")
|
| 189 |
+
# combined_file = os.path.join(dl_manager.download_config.cache_dir, "combined.tar.gz")
|
| 190 |
+
combined_file = os.path.join(dl_manager.downloaded_dir, "combined.tar.gz")
|
| 191 |
print(f"copying files to {combined_file}")
|
| 192 |
target_dir = os.path.dirname(combined_file)
|
| 193 |
os.makedirs(target_dir, exist_ok=True) # Create only the directory
|
|
|
|
| 199 |
shutil.copyfileobj(infile, outfile)
|
| 200 |
counter += 1
|
| 201 |
print(f"extacting from {combined_file}")
|
| 202 |
+
data_dir = dl_manager.extract(combined_file)
|
| 203 |
+
# data_dir = extract(combined_file)
|
| 204 |
os.remove(combined_file)
|
| 205 |
print(f"data_dir: {data_dir}")
|
| 206 |
except Exception as e:
|