Update RefRef.py
Browse files
RefRef.py
CHANGED
|
@@ -73,17 +73,17 @@ class RefRef(datasets.GeneratorBasedBuilder):
|
|
| 73 |
|
| 74 |
def _generate_examples(self, filepaths, split):
|
| 75 |
for split in ["train", "val", "test"]:
|
| 76 |
-
|
| 77 |
-
with open(
|
| 78 |
try:
|
| 79 |
data = json.load(f)
|
| 80 |
except json.JSONDecodeError:
|
| 81 |
print("error")
|
| 82 |
|
| 83 |
-
scene_name = os.path.basename(os.path.dirname(
|
| 84 |
|
| 85 |
for frame_idx, frame in enumerate(data.get("frames", [])):
|
| 86 |
-
base_dir = os.path.dirname(
|
| 87 |
|
| 88 |
yield f"{scene_name}_{frame_idx}", {
|
| 89 |
"image": os.path.join(base_dir, frame["file_path"]+".png"),
|
|
|
|
| 73 |
|
| 74 |
def _generate_examples(self, filepaths, split):
|
| 75 |
for split in ["train", "val", "test"]:
|
| 76 |
+
split_filepaths = os.path.join(filepaths, f"transforms_{split}.json")
|
| 77 |
+
with open(split_filepaths, "r", encoding="utf-8") as f:
|
| 78 |
try:
|
| 79 |
data = json.load(f)
|
| 80 |
except json.JSONDecodeError:
|
| 81 |
print("error")
|
| 82 |
|
| 83 |
+
scene_name = os.path.basename(os.path.dirname(split_filepaths))
|
| 84 |
|
| 85 |
for frame_idx, frame in enumerate(data.get("frames", [])):
|
| 86 |
+
base_dir = os.path.dirname(split_filepaths)
|
| 87 |
|
| 88 |
yield f"{scene_name}_{frame_idx}", {
|
| 89 |
"image": os.path.join(base_dir, frame["file_path"]+".png"),
|