fix train img paths
Browse files
NLVR2.py
CHANGED
|
@@ -81,7 +81,7 @@ class NLVR2Dataset(datasets.GeneratorBasedBuilder):
|
|
| 81 |
files_path = dl_manager.download_and_extract(urls)
|
| 82 |
|
| 83 |
images_files = {
|
| 84 |
-
"train": os.path.join(_URL_IMG, f'{_SPLITS["train"]}_img.zip'),
|
| 85 |
"validation": os.path.join(_URL_IMG, f'{_SPLITS["validation"]}_img.zip'),
|
| 86 |
"test1": os.path.join(_URL_IMG, f'{_SPLITS["test1"]}_img.zip'),
|
| 87 |
}
|
|
@@ -110,8 +110,13 @@ class NLVR2Dataset(datasets.GeneratorBasedBuilder):
|
|
| 110 |
common_img_identifier = ex["identifier"].split("-")
|
| 111 |
left_img_identifier = f"{split_name}-{common_img_identifier[1]}-{common_img_identifier[2]}-img0.png"
|
| 112 |
right_img_identifier = f"{split_name}-{common_img_identifier[1]}-{common_img_identifier[2]}-img1.png"
|
| 113 |
-
|
| 114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 115 |
print(left_image_path)
|
| 116 |
assert (os.path.exists(left_image_path))
|
| 117 |
assert (os.path.exists(right_image_path))
|
|
|
|
| 81 |
files_path = dl_manager.download_and_extract(urls)
|
| 82 |
|
| 83 |
images_files = {
|
| 84 |
+
"train": os.path.join(_URL_IMG, "images", f'{_SPLITS["train"]}_img.zip'),
|
| 85 |
"validation": os.path.join(_URL_IMG, f'{_SPLITS["validation"]}_img.zip'),
|
| 86 |
"test1": os.path.join(_URL_IMG, f'{_SPLITS["test1"]}_img.zip'),
|
| 87 |
}
|
|
|
|
| 110 |
common_img_identifier = ex["identifier"].split("-")
|
| 111 |
left_img_identifier = f"{split_name}-{common_img_identifier[1]}-{common_img_identifier[2]}-img0.png"
|
| 112 |
right_img_identifier = f"{split_name}-{common_img_identifier[1]}-{common_img_identifier[2]}-img1.png"
|
| 113 |
+
if split_name == "train":
|
| 114 |
+
directory = ex["directory"]
|
| 115 |
+
left_image_path = str(os.path.join(images_path, directory, left_img_identifier))
|
| 116 |
+
right_image_path = str(os.path.join(images_path, directory, right_img_identifier))
|
| 117 |
+
else:
|
| 118 |
+
left_image_path = str(os.path.join(images_path, left_img_identifier))
|
| 119 |
+
right_image_path = str(os.path.join(images_path, right_img_identifier))
|
| 120 |
print(left_image_path)
|
| 121 |
assert (os.path.exists(left_image_path))
|
| 122 |
assert (os.path.exists(right_image_path))
|