Update hugging_face.py
Browse files- hugging_face.py +6 -6
hugging_face.py
CHANGED
@@ -87,32 +87,32 @@ class RDD2020_Dataset(datasets.GeneratorBasedBuilder):
|
|
87 |
datasets.SplitGenerator(
|
88 |
name=datasets.Split.TRAIN,
|
89 |
gen_kwargs={
|
90 |
-
"
|
91 |
"split": "train",
|
92 |
},
|
93 |
),
|
94 |
datasets.SplitGenerator(
|
95 |
name=datasets.Split.TEST1,
|
96 |
gen_kwargs={
|
97 |
-
"
|
98 |
"split": "test1",
|
99 |
},
|
100 |
),
|
101 |
datasets.SplitGenerator(
|
102 |
name=datasets.Split.TEST2,
|
103 |
gen_kwargs={
|
104 |
-
"
|
105 |
"split": "test2",
|
106 |
},
|
107 |
),
|
108 |
]
|
109 |
|
110 |
-
def _generate_examples(self,
|
111 |
|
112 |
# Iterate over each country directory
|
113 |
for country_dir in ['Czech', 'India', 'Japan']:
|
114 |
-
images_dir = f"{
|
115 |
-
annotations_dir = f"{
|
116 |
|
117 |
# Iterate over each image in the country's image directory
|
118 |
for image_file in os.listdir(images_dir):
|
|
|
87 |
datasets.SplitGenerator(
|
88 |
name=datasets.Split.TRAIN,
|
89 |
gen_kwargs={
|
90 |
+
"filepath": os.path.join(extracted_path, "train"),
|
91 |
"split": "train",
|
92 |
},
|
93 |
),
|
94 |
datasets.SplitGenerator(
|
95 |
name=datasets.Split.TEST1,
|
96 |
gen_kwargs={
|
97 |
+
"filepath": os.path.join(extracted_path, "test1"),
|
98 |
"split": "test1",
|
99 |
},
|
100 |
),
|
101 |
datasets.SplitGenerator(
|
102 |
name=datasets.Split.TEST2,
|
103 |
gen_kwargs={
|
104 |
+
"filepath": os.path.join(extracted_path, "test2"),
|
105 |
"split": "test2",
|
106 |
},
|
107 |
),
|
108 |
]
|
109 |
|
110 |
+
def _generate_examples(self, filepath, split):
|
111 |
|
112 |
# Iterate over each country directory
|
113 |
for country_dir in ['Czech', 'India', 'Japan']:
|
114 |
+
images_dir = f"{filepath}/{country_dir}/images"
|
115 |
+
annotations_dir = f"{filepath}/{country_dir}/annotations/xmls" if split == "train" else None
|
116 |
|
117 |
# Iterate over each image in the country's image directory
|
118 |
for image_file in os.listdir(images_dir):
|