Update mhr_recognize_datasets.py
Browse files
mhr_recognize_datasets.py
CHANGED
|
@@ -52,16 +52,19 @@ class MHRRecognizeDatasets(datasets.GeneratorBasedBuilder):
|
|
| 52 |
return [
|
| 53 |
datasets.SplitGenerator(
|
| 54 |
name=datasets.Split.TRAIN,
|
| 55 |
-
gen_kwargs=
|
|
|
|
|
|
|
|
|
|
| 56 |
)
|
| 57 |
]
|
| 58 |
|
| 59 |
-
def _generate_examples(self,
|
| 60 |
-
print(
|
| 61 |
if self.config.name == "whole_image":
|
| 62 |
# Read csv with image labels
|
| 63 |
label_csv = read_csv(_DATA_URL["whole_labels"])
|
| 64 |
-
for i, path in enumerate(
|
| 65 |
file_name = os.path.basename(path)
|
| 66 |
# Get image id to filter the respective row of the csv
|
| 67 |
image_id = file_name
|
|
|
|
| 52 |
return [
|
| 53 |
datasets.SplitGenerator(
|
| 54 |
name=datasets.Split.TRAIN,
|
| 55 |
+
gen_kwargs={
|
| 56 |
+
"image_path": os.path.join(download_files[self.config.name+"_image"]),
|
| 57 |
+
"label_path": os.path.join(download_files[self.config.name+"_label"]),
|
| 58 |
+
},
|
| 59 |
)
|
| 60 |
]
|
| 61 |
|
| 62 |
+
def _generate_examples(self, image_path, label_path):
|
| 63 |
+
print(image_path, label_path)
|
| 64 |
if self.config.name == "whole_image":
|
| 65 |
# Read csv with image labels
|
| 66 |
label_csv = read_csv(_DATA_URL["whole_labels"])
|
| 67 |
+
for i, path in enumerate(file_path):
|
| 68 |
file_name = os.path.basename(path)
|
| 69 |
# Get image id to filter the respective row of the csv
|
| 70 |
image_id = file_name
|