LeoZhangzaolin
commited on
Commit
•
72217c4
1
Parent(s):
4d18418
Update Graptolodiea-Speciemens-Imaging.py
Browse files
Graptolodiea-Speciemens-Imaging.py
CHANGED
@@ -64,29 +64,7 @@ class GraptoloideaSpecimensDataset(datasets.GeneratorBasedBuilder):
|
|
64 |
citation=_CITATION,
|
65 |
)
|
66 |
|
67 |
-
|
68 |
-
downloaded_files = dl_manager.download(_URLS)
|
69 |
-
combined_zip_path = os.path.join(dl_manager.manual_dir, 'combined.zip')
|
70 |
-
with open(combined_zip_path, 'wb') as f_out:
|
71 |
-
for part in ['part1', 'part2']:
|
72 |
-
with open(downloaded_files[part], 'rb') as f_in:
|
73 |
-
f_out.write(f_in.read())
|
74 |
-
with zipfile.ZipFile(combined_zip_path, 'r') as zip_ref:
|
75 |
-
zip_ref.extractall(dl_manager.manual_dir)
|
76 |
-
all_files = [os.path.join(dl_manager.manual_dir, f) for f in os.listdir(dl_manager.manual_dir)
|
77 |
-
if os.path.isfile(os.path.join(dl_manager.manual_dir, f))]
|
78 |
-
random.shuffle(all_files)
|
79 |
-
split_index = int(0.8 * len(all_files))
|
80 |
-
train_files = all_files[:split_index]
|
81 |
-
validation_files = all_files[split_index:]
|
82 |
-
return [
|
83 |
-
datasets.SplitGenerator(
|
84 |
-
name=datasets.Split.TRAIN,
|
85 |
-
gen_kwargs={"filepath": train_files}),
|
86 |
-
datasets.SplitGenerator(
|
87 |
-
name=datasets.Split.VALIDATION,
|
88 |
-
gen_kwargs={"filepath": validation_files}),
|
89 |
-
]
|
90 |
|
91 |
|
92 |
|
|
|
64 |
citation=_CITATION,
|
65 |
)
|
66 |
|
67 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
|
70 |
|