MaoXun/Synergy-General-MultimodalPairs
收藏数据集概述
基本信息
- 任务类别: 视觉问答
- 语言: 英语
- 标签: llm, visual, text, mllm
- 数据规模: 1K<n<10K
数据集介绍
该数据集是由文本到图像模型和多模态大型语言模型协同生成的视觉-文本对数据集。数据集文件名的含义为:(第n次生成)(批次数量)(每个批次的初始描述数量)_(每个初始描述的细化周期数量)。例如,1_20_10_5.zip表示这是第一个数据集,包含20个批次,每个批次有10个初始描述,每个初始描述经过5次细化周期,总共有20105=1000个图像和文本对数据。
解压数据集后,会看到两个文件:一个是图像的压缩文件,另一个是包含图像路径和图像描述的CSV文件。
数据集使用
数据集的生成过程脚本可以在GitHub上找到。使用数据集时,请直接克隆git仓库。
示例代码
-
下载并重命名文件夹: shell git lfs install git clone https://huggingface.co/datasets/MaoXun/Synergy-General-MultimodalPairs mv Synergy-General-MultimodalPairs SDXL
-
解压所有文件: python import os from zipfile import ZipFile
folder_path = /content/SDXL
for filename in os.listdir(folder_path): if filename.endswith(".zip"): filepath = os.path.join(folder_path, filename) with ZipFile(filepath, r) as zip_ref: zip_ref.extractall(folder_path) print(f"Extracted: {filename}")
-
进一步解压图像文件: python rounds = 7 batches = [20, 20, 20, 20, 15, 20, 20] m = 10 n = 5
for r in range(rounds): b = batches[r] unzip_path = f"{folder_path}/{r+1}{b}{m}_{n}"
for file in os.listdir(unzip_path): if file.endswith(.zip): zip_path = os.path.join(unzip_path, file) with ZipFile(zip_path, r) as zip_ref: zip_ref.extractall(unzip_path+/images) -
构建元数据JSON文件(可选): python %cd /content
import json import ast import pandas as pd
rounds = 7 batches = [20, 20, 20, 20, 15, 20, 20] m = 10 n = 5
fixed_instruction = "Please describe this image in detail."
datas = [] for r in range(rounds): b = batches[r] base_file_path = f"/content/SDXL/{r+1}{b}{m}_{n}" S_path = f"{base_file_path}/S.csv" S_df = pd.read_csv(S_path)
for i, row in S_df.iterrows(): for j, (column, value) in enumerate(row.items()): if column == "D_init": continue value = ast.literal_eval(value) img, output = value img = img.replace("/content/images/", "") img = f"{base_file_path}/images/{img}" data = { "id": f"{r+1}_{b}_{i}_{j}", "conversations": [ {"from": "human", "value": f"{fixed_instruction}
<image>"}, {"from": "gpt", "value": output} ], "image": img, }
datas.append(data)
file_name = "data_lora.json"
with open(file_name, "w") as json_file:
json.dump(datas, json_file)
数据集目的
该研究旨在利用多模态大型语言模型、大型语言模型和文本到图像模型协同生成数据。通过多个模型之间的交互生成多样化的数据集,我们致力于自动生成视觉-文本对数据集。



