inclusionAI 开源 ConceptEdit:基于概念缩放与密集监督的图像编辑数据生成管线

蚂蚁 inclusionAI:GitHub 新仓库·2026-08-17 15:22·22小时前·inclusionAI
AI 导读

蚂蚁集团 inclusionAI 开源 ConceptEdit,一个基于概念缩放与密集监督的图像编辑数据生成管线。该管线通过三阶段流程(VLM 生成指令、FLUX 执行编辑、VQA 评估筛选)构建大规模、基于分类法的图像编辑数据集,并提供单概念与多概念两种变体。项目采用 MIT 许可证,支持断点续跑,需 OpenAI 兼容 VLM 端点与本地 FLUX 检查点。

蚂蚁 inclusionAI:GitHub 新仓库
精选
64AI 编辑部评分,满分 100

inclusionAI 开源 ConceptEdit:基于概念缩放与密集监督的图像编辑数据生成管线

2026-08-17 15:22· 22小时前· inclusionAI
AI 导读

蚂蚁集团 inclusionAI 开源 ConceptEdit,一个基于概念缩放与密集监督的图像编辑数据生成管线。该管线通过三阶段流程(VLM 生成指令、FLUX 执行编辑、VQA 评估筛选)构建大规模、基于分类法的图像编辑数据集,并提供单概念与多概念两种变体。项目采用 MIT 许可证,支持断点续跑,需 OpenAI 兼容 VLM 端点与本地 FLUX 检查点。

推荐理由

流水线把图像编辑数据生成拆为指令生成、FLUX 编辑、VLM 评判三步,多概念版本将多个并行编辑合并为一条指令并支持断点续跑,为构建带质检的编辑训练数据提供可复用框架。

正文 · AI 翻译

概念:通过概念缩放与密集监督释放图像编辑的潜力

arXiv Github Hugging Face Dataset Hugging Face Benchmark

数据集正在上传中。


图像编辑概念流水线

一个三阶段流水线,用于生成大规模、基于分类体系的图像编辑数据集:

                ┌────────────────────┐
                │   1. Instruction   │  Sample concepts from a
  input images ─▶│       Generation   ├─▶ per-image JSON
                │   (VLM as author)  │   (+VQA test set)
                └────────────────────┘
                          │
                          ▼
                ┌────────────────────┐
                │   2. Image Edit    │  Run FLUX with the
                │      with FLUX     ├─▶  generated instruction
                └────────────────────┘
                          │
                          ▼
                ┌────────────────────┐
                │   3. VQA Evaluator │  Score each edit, decide
                │  (VLM as judge)    ├─▶  keep / discard / recaption
                └────────────────────┘

两种变体并行发布:

变体 每张图像的输出 使用场景
单概念 一次编辑,一条指令 经典指令微调数据
多概念 2–5 个并行编辑打包进一条组合指令 密集、多编辑数据

仓库结构

image_editing_pipeline/
├── config.example.py          # copy → config.py and fill in keys
├── data/
│   ├── taxonomy_single.json   # taxonomy used by single-concept generator
│   └── taxonomy_multi.json    # taxonomy used by multi-concept generator
├── pipeline/
│   ├── prompt_single.py       # VLM call: single-concept instruction author
│   ├── prompt_multi.py        # VLM call: multi-concept instruction author
│   ├── prompt_eval.py         # system/user prompts for the VQA judge
│   │
│   ├── instruct_gen.py        # step 1 — single-concept
│   ├── flux_edit.py           # step 2 — single-concept
│   ├── eval_metric.py         # step 3 — single-concept
│   │
│   ├── multi_instruct_gen.py  # step 1 — multi-concept
│   ├── multi_flux_edit.py     # step 2 — multi-concept
│   └── multi_eval_metric.py   # step 3 — multi-concept
├── requirements.txt
└── README.md

环境配置

git clone <this repo>
cd image_editing_pipeline

python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

# fill in model paths / API keys
cp config.example.py config.py
$EDITOR config.py

config.py 已被 gitignore 忽略——切勿提交它。

你需要准备:

  • 一个兼容 OpenAI 的 VLM 端点(例如用 vLLM 或 SGLang 部署的视觉语言模型),用于指令生成与评估;
  • 一个可由 🤗 diffusers 加载的本地 FLUX 检查点;
  • (可选)如果你的源图像存储在对象存储中,则需要对象存储凭据;本地文件输入也完全支持。

运行流水线

所有命令均从仓库根目录运行(这样 config.py 就在 Python 路径上)。

单概念

# 1. Generate edit instructions
python -m pipeline.instruct_gen \
    --image-dir   /path/to/source_images \
    --taxonomy    data/taxonomy_single.json \
    --save-dir    /path/to/output

# 2. Run FLUX edits (pass one or more batch_<N>/ subfolders)
python -m pipeline.flux_edit /path/to/output/batch_0 /path/to/output/batch_1

# 3. VQA evaluation
python -m pipeline.eval_metric /path/to/output/batch_0 /path/to/output/batch_1

每一步的输出都位于其输入旁边:

batch_0/
├── 0_0_2.json                 # instruction + VQA test set
├── 0_0_2_edit.png             # FLUX edit result
└── 0_0_2_vqa_result.json      # judge verdict & recaption

多概念

使用 multi_ 前缀的相同命令:

python -m pipeline.multi_instruct_gen \
    --image-dir /path/to/source_images \
    --taxonomy  data/taxonomy_multi.json \
    --save-dir  /path/to/output_multi

python -m pipeline.multi_flux_edit  /path/to/output_multi/batch_0
python -m pipeline.multi_eval_metric /path/to/output_multi/batch_0

multi_instruct_gen.py 还可以通过 --jsonl 参数消费一个包含对象存储图像路径的 JSONL 文件(每行一个 JSON 对象,包含 images 字段)。使用 --help 查看完整的参数列表。


每个任务的 JSON 结构

步骤 1 之后(单概念)

{
  "option_id": 2,
  "edit_concept": {"category": "...", "sub_category": "...", "task": "...", "detail": "..."},
  "instruction_en":  "...",
  "instruction_zh":  "...",
  "detailed_instruction_en": "...",
  "detailed_instruction_zh": "...",
  "is_chinese_text_edit": false,
  "evaluation_vqa": [ /* 5 binary questions */ ],
  "local_image_path": "..."
}

步骤 1 之后(多概念)

{
  "selected_option_ids": [0, 2, 90],
  "edit_concepts_used":  [ {...}, {...}, {...} ],
  "instruction_en":  "...",
  "detailed_instruction_en": "...",
  "evaluation_vqa": [ /* N + 4 binary questions */ ],
  ...
}

步骤 3 之后(两者)

{
  "source_json": "0_0_2.json",
  "overall_vqa_score": 0.8,
  "final_decision": {
    "keep": true,
    "recaption_prompt_en": "...",   // only filled if the original instruction missed the actual change
    "recaption_prompt_zh": "...",
    "reason": "..."
  },
  "vqa_details": [ /* per-question judgment */ ]
}

断点续跑 / 容错

每一步都是幂等且可安全续跑的:

  • instruct_gen 会跳过那些已存在带正确前缀 JSON 的图像;
  • flux_edit 会跳过那些 _edit.png 已存在的 JSON;
  • eval_metric 会跳过那些 _vqa_result.json 已存在的 JSON。

终止进程后重新运行,会从上次中断的位置精确接续。


许可证

以 MIT 许可证发布。参见 LICENSE。

来源:蚂蚁 inclusionAI:GitHub 新仓库· github.com