Commit
·
6ef877b
1
Parent(s):
8fc2d4a
Update stackmix_hkr.py
Browse files- stackmix_hkr.py +3 -9
stackmix_hkr.py
CHANGED
@@ -24,19 +24,13 @@ class StackmixHKR(datasets.GeneratorBasedBuilder):
|
|
24 |
_URLS = {f"img{i:02d}": f"img/img-{i:02d}.zip" for i in range(10)}
|
25 |
_URLS["labels"] = "gt.txt"
|
26 |
|
27 |
-
data_paths = dl_manager.
|
28 |
-
|
29 |
-
img_path = os.path.split(data_paths["img00"])[0]
|
30 |
|
31 |
-
for archive_path in archive_paths:
|
32 |
-
with zipfile.ZipFile(archive_path) as archive:
|
33 |
-
archive.extractall(img_path)
|
34 |
-
|
35 |
-
image_paths = [os.path.join(img_path, img_name) for img_name in os.listdir(img_path)]
|
36 |
return [datasets.SplitGenerator(
|
37 |
name=datasets.Split.TRAIN,
|
38 |
gen_kwargs={
|
39 |
-
"image_paths": image_paths,
|
40 |
"labels_path": data_paths["labels"]
|
41 |
})]
|
42 |
|
|
|
24 |
_URLS = {f"img{i:02d}": f"img/img-{i:02d}.zip" for i in range(10)}
|
25 |
_URLS["labels"] = "gt.txt"
|
26 |
|
27 |
+
data_paths = dl_manager.download_and_extract(_URLS)
|
28 |
+
image_paths = [data_paths[key] for key in data_paths if key.startswith("img")]
|
|
|
29 |
|
|
|
|
|
|
|
|
|
|
|
30 |
return [datasets.SplitGenerator(
|
31 |
name=datasets.Split.TRAIN,
|
32 |
gen_kwargs={
|
33 |
+
"image_paths": dl_manager.iter_files(image_paths),
|
34 |
"labels_path": data_paths["labels"]
|
35 |
})]
|
36 |
|