Datasets:
add image files
Browse files- .gitattributes +2 -0
- .gitignore +3 -1
- Spatial457.py +64 -0
- questions/{L0/superclevr_questions_object.json → L2_objects.json} +2 -2
- questions/L3/superclevr_questions_6d.json +0 -3
- questions/L3/superclevr_questions_physics.json +0 -3
- questions/{L1/superclevr_questions_2D_spatial.json → L3_2D_spatial.json} +2 -2
- questions/{L2/superclevr_questions_obj_occ.json → L4_occ.json} +2 -2
- questions/{L2/superclevr_questions_pose.json → L4_pose.json} +2 -2
- questions/L5_6d_spatial.json +3 -0
- questions/L5_collision.json +3 -0
- questions/easy.json +0 -3
- scenes.tar.gz +0 -3
.gitattributes
CHANGED
|
@@ -25,6 +25,7 @@
|
|
| 25 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 26 |
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 27 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 28 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 29 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 30 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
@@ -65,3 +66,4 @@ questions/L2/superclevr_questions_pose.json filter=lfs diff=lfs merge=lfs -text
|
|
| 65 |
questions/L3/superclevr_questions_6d.json filter=lfs diff=lfs merge=lfs -text
|
| 66 |
questions/L3/superclevr_questions_physics.json filter=lfs diff=lfs merge=lfs -text
|
| 67 |
scenes.tar.gz filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 25 |
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 26 |
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 27 |
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.json filter=lfs diff=lfs merge=lfs -text
|
| 29 |
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 30 |
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 31 |
*.tar filter=lfs diff=lfs merge=lfs -text
|
|
|
|
| 66 |
questions/L3/superclevr_questions_6d.json filter=lfs diff=lfs merge=lfs -text
|
| 67 |
questions/L3/superclevr_questions_physics.json filter=lfs diff=lfs merge=lfs -text
|
| 68 |
scenes.tar.gz filter=lfs diff=lfs merge=lfs -text
|
| 69 |
+
images.tar.gz filter=lfs diff=lfs merge=lfs -text
|
.gitignore
CHANGED
|
@@ -1 +1,3 @@
|
|
| 1 |
-
scenes
|
|
|
|
|
|
|
|
|
| 1 |
+
scenes
|
| 2 |
+
images
|
| 3 |
+
zip.sh
|
Spatial457.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import json
|
| 3 |
+
import datasets
|
| 4 |
+
|
| 5 |
+
|
| 6 |
+
class Spatial457(datasets.GeneratorBasedBuilder):
|
| 7 |
+
BUILDER_CONFIGS = [
|
| 8 |
+
datasets.BuilderConfig(name="L1_single"),
|
| 9 |
+
datasets.BuilderConfig(name="L2_objects"),
|
| 10 |
+
datasets.BuilderConfig(name="L3_2d_spatial"),
|
| 11 |
+
datasets.BuilderConfig(name="L4_occ"),
|
| 12 |
+
datasets.BuilderConfig(name="L4_pose"),
|
| 13 |
+
datasets.BuilderConfig(name="L5_6d_spatial"),
|
| 14 |
+
datasets.BuilderConfig(name="L5_collision"),
|
| 15 |
+
]
|
| 16 |
+
|
| 17 |
+
def _info(self):
|
| 18 |
+
return datasets.DatasetInfo(
|
| 19 |
+
description="Spatial457: A multi-task spatial visual question answering dataset.",
|
| 20 |
+
features=datasets.Features({
|
| 21 |
+
"image": datasets.Image(), # 自动加载图片
|
| 22 |
+
"image_filename": datasets.Value("string"),
|
| 23 |
+
"question": datasets.Value("string"),
|
| 24 |
+
"answer": datasets.Value("string"), # 会自动处理 True / False / str
|
| 25 |
+
"question_index": datasets.Value("int32"),
|
| 26 |
+
"program": datasets.Sequence(
|
| 27 |
+
{
|
| 28 |
+
"type": datasets.Value("string"),
|
| 29 |
+
"inputs": datasets.Sequence(datasets.Value("int32")),
|
| 30 |
+
"_output": datasets.Value("string"),
|
| 31 |
+
"value_inputs": datasets.Sequence(datasets.Value("string")),
|
| 32 |
+
}
|
| 33 |
+
),
|
| 34 |
+
}),
|
| 35 |
+
supervised_keys=None,
|
| 36 |
+
)
|
| 37 |
+
|
| 38 |
+
def _split_generators(self, dl_manager):
|
| 39 |
+
data_dir = dl_manager.manual_dir # expects local `images/` and `questions/`
|
| 40 |
+
|
| 41 |
+
task_json = os.path.join(data_dir, "questions", f"{self.config.name}.json")
|
| 42 |
+
image_dir = os.path.join(data_dir, "images")
|
| 43 |
+
|
| 44 |
+
return [
|
| 45 |
+
datasets.SplitGenerator(
|
| 46 |
+
name=datasets.Split.VALIDATION,
|
| 47 |
+
gen_kwargs={"json_file": task_json, "image_dir": image_dir}
|
| 48 |
+
)
|
| 49 |
+
]
|
| 50 |
+
|
| 51 |
+
def _generate_examples(self, json_file, image_dir):
|
| 52 |
+
with open(json_file, "r", encoding="utf-8") as f:
|
| 53 |
+
all_data = json.load(f)["questions"]
|
| 54 |
+
|
| 55 |
+
for idx, q in enumerate(all_data):
|
| 56 |
+
img_path = os.path.join(image_dir, q["image_filename"])
|
| 57 |
+
yield idx, {
|
| 58 |
+
"image": img_path,
|
| 59 |
+
"image_filename": q["image_filename"],
|
| 60 |
+
"question": q["question"],
|
| 61 |
+
"answer": str(q["answer"]),
|
| 62 |
+
"question_index": q["question_index"],
|
| 63 |
+
"program": q["program"],
|
| 64 |
+
}
|
questions/{L0/superclevr_questions_object.json → L2_objects.json}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:428d6f536a9d24417ef446b1faf543aacd9cc923bbd07462a521ef9ec738b05c
|
| 3 |
+
size 323028588
|
questions/L3/superclevr_questions_6d.json
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:383759abed051c130922dacdd8a2b4952160068cbc23c4c716912539a148ac46
|
| 3 |
-
size 772821464
|
|
|
|
|
|
|
|
|
|
|
|
questions/L3/superclevr_questions_physics.json
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:3d7de6d48701aeb523ff980485a172c4afb0df39dc4e7e520c0fbc1b209e63de
|
| 3 |
-
size 347007425
|
|
|
|
|
|
|
|
|
|
|
|
questions/{L1/superclevr_questions_2D_spatial.json → L3_2D_spatial.json}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7545f1cac93881c2b6851d2c231d78dfa3cfc9453170ba79794ee091084a5c1e
|
| 3 |
+
size 591718434
|
questions/{L2/superclevr_questions_obj_occ.json → L4_occ.json}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:24def02f4f97207bfa6fffcbe9ffd8a169d01e26bada8c856253e9dfe4608226
|
| 3 |
+
size 210830349
|
questions/{L2/superclevr_questions_pose.json → L4_pose.json}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d537c21c49014b23dff551163c60b5006356d8a221878a68413d231bfd11073d
|
| 3 |
+
size 265039808
|
questions/L5_6d_spatial.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:12f4cd78cf22a14759a808a5055fc651647fd76aac2502ec18f5aa3febba4839
|
| 3 |
+
size 1168141474
|
questions/L5_collision.json
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5f89c7fd27622ac3d2004d59afc9d961c47017cac595d6db8a26f44e1d4e5949
|
| 3 |
+
size 330346826
|
questions/easy.json
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:0444f33f9013811f392b209d326e1638d4929ca9ea1c982fd721cabf11c84d25
|
| 3 |
-
size 8202
|
|
|
|
|
|
|
|
|
|
|
|
scenes.tar.gz
DELETED
|
@@ -1,3 +0,0 @@
|
|
| 1 |
-
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:43ffe152d0e3aa412496c4af883e309d29aaaf7e5b4ff6e62b5a3b24a28cfe16
|
| 3 |
-
size 238891119
|
|
|
|
|
|
|
|
|
|
|
|