Update AASL.py
Browse files
AASL.py
CHANGED
|
@@ -56,21 +56,18 @@ class AASL(datasets.GeneratorBasedBuilder):
|
|
| 56 |
|
| 57 |
def _split_generators(self, dl_manager):
|
| 58 |
images_path = dl_manager.download_and_extract(_URL)
|
| 59 |
-
print("print(images_path)")
|
| 60 |
-
print(images_path)
|
| 61 |
return [datasets.SplitGenerator(
|
| 62 |
name=datasets.Split.TRAIN, gen_kwargs={"images":dl_manager.iter_files([images_path])}
|
| 63 |
)]
|
| 64 |
|
| 65 |
def _generate_examples(self, images):
|
| 66 |
-
|
| 67 |
for i, file in enumerate(images):
|
| 68 |
-
if
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
|
|
|
|
| 56 |
|
| 57 |
def _split_generators(self, dl_manager):
|
| 58 |
images_path = dl_manager.download_and_extract(_URL)
|
|
|
|
|
|
|
| 59 |
return [datasets.SplitGenerator(
|
| 60 |
name=datasets.Split.TRAIN, gen_kwargs={"images":dl_manager.iter_files([images_path])}
|
| 61 |
)]
|
| 62 |
|
| 63 |
def _generate_examples(self, images):
|
| 64 |
+
|
| 65 |
for i, file in enumerate(images):
|
| 66 |
+
if i%2==0:
|
| 67 |
+
if os.path.basename(file).endswith(".jpg"):
|
| 68 |
+
with open(file, "rb") as f:
|
| 69 |
+
yield str(i), {
|
| 70 |
+
"image": file,
|
| 71 |
+
"label": os.path.basename(file).split('.')[0].split('_')[0],
|
| 72 |
+
}
|
| 73 |
+
idx += 1
|
|
|