Upload SkyScenes.py
Browse files- SkyScenes.py +24 -15
SkyScenes.py
CHANGED
|
@@ -889,27 +889,36 @@ class SKYSCENES(datasets.GeneratorBasedBuilder):
|
|
| 889 |
)
|
| 890 |
|
| 891 |
def _split_generators(self, dl_manager):
|
| 892 |
-
data_files = []
|
| 893 |
-
final_kwargs = {}
|
| 894 |
# print(len(self.config.data_urls)
|
| 895 |
-
for key,_ in self.config.data_urls.items():
|
| 896 |
-
|
| 897 |
-
|
| 898 |
-
|
|
|
|
|
|
|
| 899 |
return [
|
| 900 |
datasets.SplitGenerator(
|
| 901 |
name=datasets.Split.TRAIN,
|
| 902 |
-
gen_kwargs=
|
|
|
|
|
|
|
|
|
|
| 903 |
),
|
| 904 |
]
|
| 905 |
|
| 906 |
def _generate_examples(self, images=None):
|
| 907 |
"""Generate images and labels for splits."""
|
| 908 |
-
for
|
| 909 |
-
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 889 |
)
|
| 890 |
|
| 891 |
def _split_generators(self, dl_manager):
|
| 892 |
+
# data_files = []
|
| 893 |
+
# final_kwargs = {}
|
| 894 |
# print(len(self.config.data_urls)
|
| 895 |
+
# for key,_ in self.config.data_urls.items():
|
| 896 |
+
# data_files = dl_manager.download_and_extract(self.config.data_urls)
|
| 897 |
+
data_files = dl_manager.download(self.config.data_urls["images"])
|
| 898 |
+
# data_files.append(down)
|
| 899 |
+
# final_kwargs[key] = down
|
| 900 |
+
print()
|
| 901 |
return [
|
| 902 |
datasets.SplitGenerator(
|
| 903 |
name=datasets.Split.TRAIN,
|
| 904 |
+
gen_kwargs={
|
| 905 |
+
"images":dl_manager.iter_archive(data_files)
|
| 906 |
+
# "images": data_files["images"],
|
| 907 |
+
},
|
| 908 |
),
|
| 909 |
]
|
| 910 |
|
| 911 |
def _generate_examples(self, images=None):
|
| 912 |
"""Generate images and labels for splits."""
|
| 913 |
+
for file_path, file_obj in images:
|
| 914 |
+
yield file_path, {
|
| 915 |
+
"image": {"path": file_path, "bytes": file_obj.read()},
|
| 916 |
+
}
|
| 917 |
+
# for j in range(len(images)):
|
| 918 |
+
# dict_final = {}
|
| 919 |
+
# filepath_img = os.listdir(images[j])
|
| 920 |
+
# for i in range(len(os.listdir(images[j]))):
|
| 921 |
+
# with open(os.path.join(images[j], filepath_img[i]), "rb") as f:
|
| 922 |
+
# image_bytes = f.read()
|
| 923 |
+
# dict_final["files"] = {"path":filepath_img[i],"bytes":image_bytes}
|
| 924 |
+
# yield filepath_img[i], dict_final
|