Update foot.py
Browse files
foot.py
CHANGED
@@ -15,7 +15,7 @@ _LICENSE = "CC BY 4.0"
|
|
15 |
class FOOT40KConfig(datasets.BuilderConfig):
|
16 |
"""Builder Config for FOOT40K"""
|
17 |
|
18 |
-
def __init__(self, data_url, metadata_url, **kwargs):
|
19 |
"""BuilderConfig for FOOT40K.
|
20 |
Args:
|
21 |
data_url: `string`, url to download the zip file from.
|
@@ -24,7 +24,7 @@ class FOOT40KConfig(datasets.BuilderConfig):
|
|
24 |
"""
|
25 |
super(FOOT40KConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
|
26 |
self.data_url = data_url
|
27 |
-
self.metadata_url = metadata_url
|
28 |
|
29 |
class FOOT40K(datasets.GeneratorBasedBuilder):
|
30 |
"""FOOT40K Images dataset"""
|
@@ -34,7 +34,7 @@ class FOOT40K(datasets.GeneratorBasedBuilder):
|
|
34 |
name="shoe_all",
|
35 |
description="Shoe Data.",
|
36 |
data_url="https://huggingface.co/datasets/aidystark/FOOT40K/resolve/main/FOOT40k.tar.gz?download=true",
|
37 |
-
metadata_url = "https://huggingface.co/datasets/aidystark/FOOT40K/resolve/main/foot40k.json?download=true",
|
38 |
|
39 |
),
|
40 |
|
@@ -42,11 +42,10 @@ class FOOT40K(datasets.GeneratorBasedBuilder):
|
|
42 |
|
43 |
def _info(self):
|
44 |
return datasets.DatasetInfo(
|
45 |
-
description=_DESCRIPTION,
|
46 |
features=datasets.Features(
|
47 |
{
|
48 |
"image": datasets.Image(),
|
49 |
-
"
|
50 |
}
|
51 |
),
|
52 |
homepage=_HOMEPAGE,
|
@@ -62,7 +61,7 @@ class FOOT40K(datasets.GeneratorBasedBuilder):
|
|
62 |
name=datasets.Split.TRAIN,
|
63 |
gen_kwargs={
|
64 |
"images": image_iters,
|
65 |
-
"metadata_path": metadata_path,
|
66 |
},
|
67 |
),
|
68 |
|
@@ -73,16 +72,16 @@ class FOOT40K(datasets.GeneratorBasedBuilder):
|
|
73 |
idx = 0
|
74 |
|
75 |
|
76 |
-
with open(metadata_path, "r") as f:
|
77 |
-
|
78 |
|
79 |
-
labels = [item["Label"] for item in filename_to_label]
|
80 |
|
81 |
|
82 |
for filepath, image in images:
|
83 |
yield idx, {
|
84 |
"image": {"path": filepath, "bytes": image.read()},
|
85 |
-
"label": labels[idx],
|
86 |
}
|
87 |
|
88 |
idx += 1
|
|
|
15 |
class FOOT40KConfig(datasets.BuilderConfig):
|
16 |
"""Builder Config for FOOT40K"""
|
17 |
|
18 |
+
def __init__(self, data_url, **kwargs):# metadata_url, **kwargs):
|
19 |
"""BuilderConfig for FOOT40K.
|
20 |
Args:
|
21 |
data_url: `string`, url to download the zip file from.
|
|
|
24 |
"""
|
25 |
super(FOOT40KConfig, self).__init__(version=datasets.Version("1.0.0"), **kwargs)
|
26 |
self.data_url = data_url
|
27 |
+
#self.metadata_url = metadata_url
|
28 |
|
29 |
class FOOT40K(datasets.GeneratorBasedBuilder):
|
30 |
"""FOOT40K Images dataset"""
|
|
|
34 |
name="shoe_all",
|
35 |
description="Shoe Data.",
|
36 |
data_url="https://huggingface.co/datasets/aidystark/FOOT40K/resolve/main/FOOT40k.tar.gz?download=true",
|
37 |
+
#metadata_url = "https://huggingface.co/datasets/aidystark/FOOT40K/resolve/main/foot40k.json?download=true",
|
38 |
|
39 |
),
|
40 |
|
|
|
42 |
|
43 |
def _info(self):
|
44 |
return datasets.DatasetInfo(
|
|
|
45 |
features=datasets.Features(
|
46 |
{
|
47 |
"image": datasets.Image(),
|
48 |
+
#"Label": datasets.Value("string"),
|
49 |
}
|
50 |
),
|
51 |
homepage=_HOMEPAGE,
|
|
|
61 |
name=datasets.Split.TRAIN,
|
62 |
gen_kwargs={
|
63 |
"images": image_iters,
|
64 |
+
#"metadata_path": metadata_path,
|
65 |
},
|
66 |
),
|
67 |
|
|
|
72 |
idx = 0
|
73 |
|
74 |
|
75 |
+
#with open(metadata_path, "r") as f:
|
76 |
+
# filename_to_label = json.load(f)
|
77 |
|
78 |
+
#labels = [item["Label"] for item in filename_to_label]
|
79 |
|
80 |
|
81 |
for filepath, image in images:
|
82 |
yield idx, {
|
83 |
"image": {"path": filepath, "bytes": image.read()},
|
84 |
+
#"label": labels[idx],
|
85 |
}
|
86 |
|
87 |
idx += 1
|