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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
language:
|
4 |
+
- zh
|
5 |
+
- en
|
6 |
+
tags:
|
7 |
+
- vlm
|
8 |
+
- benchmark
|
9 |
+
- graphic-reasoning
|
10 |
+
- intelligence-test
|
11 |
+
---
|
12 |
+
# 🧠 ReasonBench: Benchmark for Complex Visual Reasoning
|
13 |
+
|
14 |
+
## 🌐 Overview
|
15 |
+
**ReasonBench** is a comprehensive benchmark designed to evaluate Visual Language Models (VLMs) on complex graphical reasoning tasks. It contains **1,613 problems** collected from real-world intelligence tests, covering **11 core cognitive dimensions** and **29 task types**. This benchmark provides a robust framework for assessing VLMs' spatial, relational, and abstract reasoning capabilities.
|
16 |
+
|
17 |
+
**Dataset Type**: Visual Language Reasoning · Graphical Reasoning · Benchmark Evaluation
|
18 |
+
|
19 |
+
## 📊 Dataset Structure
|
20 |
+
### Core Cognitive Dimensions & Task Types
|
21 |
+
| Cognitive Dimension | Task Type | Count |
|
22 |
+
|--------------------------|-----------------------------|-------|
|
23 |
+
| **Positional Patterns** | Translation | 94 |
|
24 |
+
| | Rotation | 56 |
|
25 |
+
| | Combination | 30 |
|
26 |
+
| **Stylistic Patterns** | Crossing | 54 |
|
27 |
+
| | Addition/Subtraction | 67 |
|
28 |
+
| | Black/White Operation | 63 |
|
29 |
+
| **Attribute Patterns** | Symmetry | 109 |
|
30 |
+
| | Open/Close State | 19 |
|
31 |
+
| | Combination | 6 |
|
32 |
+
| **Quantitative Patterns**| Lines | 173 |
|
33 |
+
| | Faces | 137 |
|
34 |
+
| | Points | 66 |
|
35 |
+
| | Elements | 94 |
|
36 |
+
| | Combination | 50 |
|
37 |
+
| **Spatial Patterns** | Cubes | 109 |
|
38 |
+
| | 3D | 46 |
|
39 |
+
| | Polyhedrons | 17 |
|
40 |
+
| | Three Views | 40 |
|
41 |
+
| | Cross-Sections | 35 |
|
42 |
+
| | Spatial Quantitative Trans. | 10 |
|
43 |
+
| **Special Patterns** | 2D Combination | 31 |
|
44 |
+
| | Figure Relations | 40 |
|
45 |
+
| **Alphanumeric** | Alphanumeric | 27 |
|
46 |
+
| **B&W Blocks** | Black & White Blocks | 32 |
|
47 |
+
| **Other Patterns** | Comprehensive | 34 |
|
48 |
+
| **MENSA** | Task 1 | 35 |
|
49 |
+
| | Task 2 | 39 |
|
50 |
+
| **Raven** | Task 1 | 40 |
|
51 |
+
| | Task 2 | 60 |
|
52 |
+
|
53 |
+
### 🖼️ Input Formats
|
54 |
+
| Format | Description |
|
55 |
+
|-----------------------|-------------|
|
56 |
+
| **Integrated Format** | Presents questions and options in a single image for holistic processing |
|
57 |
+
| **Separated Format** | Splits questions and options into multiple images for step-by-step reasoning |
|
58 |
+
|
59 |
+
## 🔍 Key Features
|
60 |
+
- **Multi-format Evaluation**: Supports both integrated and separated input formats
|
61 |
+
- **Full Accessibility**: Provides public URLs for all images (questions, options, and combined sets)
|
62 |
+
- **Human Baseline**: Includes human performance metrics for comparison
|
63 |
+
- **Diverse Tasks**: Covers 29 distinct reasoning task types across 11 cognitive dimensions
|
64 |
+
|
65 |
+
## 🚀 Usage(GPT-4o example)
|
66 |
+
```python
|
67 |
+
import base64
|
68 |
+
import requests
|
69 |
+
import os
|
70 |
+
from openai import OpenAI # Requires openai>=1.0.0
|
71 |
+
|
72 |
+
# Configuration
|
73 |
+
api_key = os.getenv("OPENAI_API_KEY")
|
74 |
+
if not api_key:
|
75 |
+
raise ValueError("Missing OPENAI_API_KEY environment variable")
|
76 |
+
|
77 |
+
# Initialize client (official SDK approach)
|
78 |
+
client = OpenAI(api_key=api_key)
|
79 |
+
|
80 |
+
def process_image_question(image_path: str, question: str, max_tokens=300):
|
81 |
+
"""Send image and question to GPT-4o API"""
|
82 |
+
# Encode image to base64
|
83 |
+
base64_image = base64.b64encode(open(image_path, "rb").read()).decode("utf-8")
|
84 |
+
|
85 |
+
# Construct messages payload
|
86 |
+
messages = [
|
87 |
+
{
|
88 |
+
"role": "user",
|
89 |
+
"content": [
|
90 |
+
{"type": "text", "text": question},
|
91 |
+
{
|
92 |
+
"type": "image_url",
|
93 |
+
"image_url": {
|
94 |
+
"url": f"data:image/jpeg;base64,{base64_image}",
|
95 |
+
"detail": "auto" # Options: low, high, auto
|
96 |
+
}
|
97 |
+
}
|
98 |
+
]
|
99 |
+
}
|
100 |
+
]
|
101 |
+
|
102 |
+
# Make API request
|
103 |
+
response = client.chat.completions.create(
|
104 |
+
model="gpt-4o",
|
105 |
+
messages=messages,
|
106 |
+
max_tokens=max_tokens
|
107 |
+
)
|
108 |
+
|
109 |
+
return response.choices[0].message.content
|
110 |
+
|
111 |
+
# Example usage
|
112 |
+
if __name__ == "__main__":
|
113 |
+
image_path = "path/to/your/image.jpg" # Update with actual path
|
114 |
+
user_question = "What's in this image?" # Customize your question
|
115 |
+
|
116 |
+
try:
|
117 |
+
answer = process_image_question(image_path, user_question)
|
118 |
+
print("AI Response:", answer)
|
119 |
+
except Exception as e:
|
120 |
+
print(f"Error: {str(e)}")
|
121 |
+
---
|
122 |
+
|
123 |
+
# 🧠 ReasonBench:复杂图形推理的视觉语言模型评估基准
|
124 |
+
|
125 |
+
## 🌐 概述
|
126 |
+
**ReasonBench** 是一个用于评估视觉语言模型(VLMs)在复杂图形推理任务表现的基准测试。数据集包含从真实智力测试中收集的 **1,613个问题**,覆盖**11个核心认知维度**和**29种任务类型**,为评估VLMs的空间、关系和抽象推理能力提供综合框架。
|
127 |
+
|
128 |
+
**数据集类型**:视觉语言推理 · 图形推理 · 基准评估
|
129 |
+
|
130 |
+
## 📊 数据结构
|
131 |
+
### 核心认知维度与任务类型
|
132 |
+
| 认知维度 | 任务类型 | 数量 |
|
133 |
+
|---------------------|------------------------|------|
|
134 |
+
| **位置规律** | 平移 | 94 |
|
135 |
+
| | 旋转 | 56 |
|
136 |
+
| | 组合 | 30 |
|
137 |
+
| **样式规律** | 穿越 | 54 |
|
138 |
+
| | 加减法 | 67 |
|
139 |
+
| | 黑白运算 | 63 |
|
140 |
+
| **属性规律** | 对称 | 109 |
|
141 |
+
| | 开闭状态 | 19 |
|
142 |
+
| | 组合 | 6 |
|
143 |
+
| **数量规律** | 线 | 173 |
|
144 |
+
| | 面 | 137 |
|
145 |
+
| | 点 | 66 |
|
146 |
+
| | 元素 | 94 |
|
147 |
+
| | 组合 | 50 |
|
148 |
+
| **空间规律** | 立方体 | 109 |
|
149 |
+
| | 3D | 46 |
|
150 |
+
| | 多面体 | 17 |
|
151 |
+
| | 三视图 | 40 |
|
152 |
+
| | 剖视图 | 35 |
|
153 |
+
| | 空间数量变换 | 10 |
|
154 |
+
| **特殊规律** | 2D组合 | 31 |
|
155 |
+
| | 图形关系 | 40 |
|
156 |
+
| **字母数字** | 字母数字 | 27 |
|
157 |
+
| **黑白块** | 黑白块 | 32 |
|
158 |
+
| **其他规律** | 综合 | 34 |
|
159 |
+
| **门萨** | 任务1 | 35 |
|
160 |
+
| | 任务2 | 39 |
|
161 |
+
| **瑞文** | 任务1 | 40 |
|
162 |
+
| | 任务2 | 60 |
|
163 |
+
|
164 |
+
### 🖼️ 输入格式
|
165 |
+
| 格式 | 描述 |
|
166 |
+
|---------------------|------|
|
167 |
+
| **集成格式** | 问题与选项呈现在单个图形中,便于模型整体处理 |
|
168 |
+
| **分离格式** | 将问题与选项拆分为多个图形,测试分步推理能力 |
|
169 |
+
|
170 |
+
## 🔍 核心特性
|
171 |
+
- **多格式评估**:支持整体式和分隔式两种输入格式
|
172 |
+
- **完全开放**:公开所有格式的图片URL(题目、选项、题目+选项)
|
173 |
+
- **人类基准**:提供人类准确率作为参考基准
|
174 |
+
- **多样化任务**:覆盖11个认知维度的29种推理任务
|
175 |
+
|
176 |
+
## 🚀 使用示例(以openai GPT-4o为例)
|
177 |
+
```python
|
178 |
+
import base64
|
179 |
+
import requests
|
180 |
+
import os
|
181 |
+
|
182 |
+
# 配置OpenAI API密钥
|
183 |
+
api_key = os.getenv("OPENAI_API_KEY") # 建议将密钥存储在环境变量中
|
184 |
+
if not api_key:
|
185 |
+
raise ValueError("请设置OPENAI_API_KEY环境变量")
|
186 |
+
|
187 |
+
# 图像处理函数
|
188 |
+
def encode_image(image_path):
|
189 |
+
"""将本地图像编码为base64字符串"""
|
190 |
+
with open(image_path, "rb") as image_file:
|
191 |
+
return base64.b64encode(image_file.read()).decode('utf-8')
|
192 |
+
|
193 |
+
# 示例图像路径和问题
|
194 |
+
image_path = "path/to/your/image.jpg" # 替换为你的图像路径
|
195 |
+
question = "描述这张图片的内容" # 替换为你的问题
|
196 |
+
|
197 |
+
# 构建API请求
|
198 |
+
headers = {
|
199 |
+
"Content-Type": "application/json",
|
200 |
+
"Authorization": f"Bearer {api_key}"
|
201 |
+
}
|
202 |
+
|
203 |
+
payload = {
|
204 |
+
"model": "gpt-4o", # 使用支持图像的模型
|
205 |
+
"messages": [
|
206 |
+
{
|
207 |
+
"role": "user",
|
208 |
+
"content": [
|
209 |
+
{
|
210 |
+
"type": "text",
|
211 |
+
"text": question
|
212 |
+
},
|
213 |
+
{
|
214 |
+
"type": "image_url",
|
215 |
+
"image_url": {
|
216 |
+
"url": f"data:image/jpeg;base64,{encode_image(image_path)}"
|
217 |
+
}
|
218 |
+
}
|
219 |
+
]
|
220 |
+
}
|
221 |
+
],
|
222 |
+
"max_tokens": 300 # 控制响应长度
|
223 |
+
}
|
224 |
+
|
225 |
+
# 发送请求
|
226 |
+
response = requests.post(
|
227 |
+
"https://api.openai.com/v1/chat/completions",
|
228 |
+
headers=headers,
|
229 |
+
json=payload
|
230 |
+
)
|
231 |
+
|
232 |
+
# 处理响应
|
233 |
+
if response.status_code == 200:
|
234 |
+
result = response.json()
|
235 |
+
answer = result['choices'][0]['message']['content']
|
236 |
+
print("AI回答:", answer)
|
237 |
+
else:
|
238 |
+
print("请求失败,状态码:", response.status_code)
|
239 |
+
print("错误信息:", response.text)
|
240 |
+
```
|