Datasets:
Update horse2zebra.py
Browse files- horse2zebra.py +7 -4
horse2zebra.py
CHANGED
@@ -3,6 +3,8 @@
|
|
3 |
import os
|
4 |
import datasets
|
5 |
|
|
|
|
|
6 |
_CITATION = """\
|
7 |
|
8 |
"""
|
@@ -27,7 +29,7 @@ class Horse2Zebra(datasets.GeneratorBasedBuilder):
|
|
27 |
def _info(self):
|
28 |
features = datasets.Features(
|
29 |
{
|
30 |
-
"image": datasets.Image()
|
31 |
}
|
32 |
)
|
33 |
return datasets.DatasetInfo(
|
@@ -66,7 +68,8 @@ class Horse2Zebra(datasets.GeneratorBasedBuilder):
|
|
66 |
image_dir = os.path.join(datapath, dir)
|
67 |
for idx, image_file in enumerate(os.listdir(image_dir)):
|
68 |
image_id = image_file.split(".")[0]
|
69 |
-
|
70 |
-
|
71 |
-
|
|
|
72 |
|
|
|
3 |
import os
|
4 |
import datasets
|
5 |
|
6 |
+
from PIL import Image
|
7 |
+
|
8 |
_CITATION = """\
|
9 |
|
10 |
"""
|
|
|
29 |
def _info(self):
|
30 |
features = datasets.Features(
|
31 |
{
|
32 |
+
"image": datasets.Image()
|
33 |
}
|
34 |
)
|
35 |
return datasets.DatasetInfo(
|
|
|
68 |
image_dir = os.path.join(datapath, dir)
|
69 |
for idx, image_file in enumerate(os.listdir(image_dir)):
|
70 |
image_id = image_file.split(".")[0]
|
71 |
+
with Image.open(os.path.join(image_dir, image_file)) as img :
|
72 |
+
yield idx, {
|
73 |
+
"image": img.convert("RGB"),
|
74 |
+
}
|
75 |
|