Diagram2Code
收藏资源简介:
Diagram2Code Benchmark 是一个用于多模态大语言模型(MLLM)图表识别任务的基准测试数据集。该数据集旨在评估模型将各种类型的图表图像转换为结构化代码表示的能力。数据内容包含多种图表类型,具体包括:流程图(flowchart)、序列图(sequence_diagram)、电路图(circuit_diagram)、状态图(state_diagram)和网络拓扑图(network_topology)。每个数据样本由图表图像和对应的模型识别输出组成。核心数据字段包括:图像路径(image)、图表类型(type)、生成输出的模型名称(model),以及模型识别出的多种代码表示形式及其编译验证结果,具体涵盖 Mermaid 代码、PlantUML 代码、XML 代码、DOT (Graphviz) 代码和 SVG 代码,并分别附有对应的编译结果字段(例如 `mermaid_compilation_result`)。数据集提供了多个配置视图,除了默认配置外,还包括用于图对象评估的样本级和模型级配置,以及一个面向研究者的紧凑型有效实验总结表(effective_experiment_summary),该总结表筛选了在 FlowGen、FlowVQA 和 FlowDiagBench 等基准上可用的实验数据行。数据集规模属于小规模(n<1K),适用于图像到文本、视觉问答等任务,特别是图表理解与代码生成相关的研究与评估。
Diagram2Code Benchmark is a benchmark dataset for multimodal large language model (MLLM) chart recognition tasks. It aims to evaluate the ability of models to convert various types of chart images into structured code representations. The data includes multiple chart types: flowchart, sequence diagram, circuit diagram, state diagram, and network topology. Each data sample consists of a chart image and the corresponding model recognition output. Key data fields include image path (image), chart type (type), model name generating the output (model), and multiple code representation forms identified by the model along with their compilation verification results, specifically covering Mermaid code, PlantUML code, XML code, DOT (Graphviz) code, and SVG code, each accompanied by corresponding compilation result fields (e.g., `mermaid_compilation_result`). The dataset provides multiple configuration views, including default configuration, sample-level and model-level configurations for graph object evaluation, and a compact effective experiment summary table (effective_experiment_summary) for researchers, which filters experimental data rows available on benchmarks such as FlowGen, FlowVQA, and FlowDiagBench. The dataset is small-scale (n<1K) and suitable for tasks like image-to-text and visual question answering, particularly for research and evaluation related to chart understanding and code generation.
数据集概述:Diagram2Code Benchmark
- 名称:Diagram2Code Benchmark
- 语言:中文、英文
- 许可证:CC-BY-4.0
- 任务类别:图像到文本
- 具体任务:视觉问答
- 数据集大小:少于1000个样本
数据集标签
- 图像
- 表格
- 数据集
- 图表
- 流程图
- 序列图
- 电路图
数据集配置
数据集包含以下四个配置:
| 配置名称 | 数据文件路径 |
|---|---|
| default | data/*.parquet |
| graph_object_eval_sample_level | graph_object_eval_sample_level/*.parquet |
| graph_object_eval_model_level | graph_object_eval_model_level/*.parquet |
| effective_experiment_summary | effective_experiment_summary/*.parquet |
图表类型 (type 字段)
支持以下图表类型(均使用小写):
flowchart:流程/决策流程图sequence_diagram:交互序列图circuit_diagram:电气/电子电路图state_diagram:状态转换图network_topology:逻辑网络拓扑图
数据集模式 (Schema)
每条记录包含以下字段:
image:图表图像文件(推荐存储为图像路径)type:图表类型model:生成结构化输出的模型名称(例如gpt-4o)mermaid:识别的 Mermaid 代码mermaid_compilation_result:Mermaid 编译结果(success/fail/ 错误信息)plantuml:识别的 PlantUML 代码plantuml_compilation_result:PlantUML 编译结果xml:识别的 XML 代码xml_compilation_result:XML 编译结果dot:识别的 DOT (Graphviz) 代码dot_compilation_result:DOT 编译结果svg:识别的 SVG 代码svg_compilation_result:SVG 编译结果
样本输出
运行 dataset.ipynb 会生成单行样本文件,位于:
data/benchmark_sample/benchmark_sample.csvdata/benchmark_sample/benchmark_sample.jsonldata/benchmark_sample/images/sample_flowchart.png
有效实验总结
effective_experiment_summary 配置提供了一个紧凑的、面向顾问的总结表格,其中包含来自 FlowGen 官方1080、FlowVQA 衍生953 和 FlowDiagBench 的当前选定可用实验行。




